swh:1:snp:f50ab94432af916b5fb8b4ad831e8dddded77084
Raw File
Tip revision: 0d6ce8112d859d97dcac7e66e9305de571b4fa22 authored by Frank Seide on 07 February 2016, 04:31:48 UTC
LSTM test now uses an actual 1D vector for the bias parameter (as opposed to a 1-column 2D matrix)
Tip revision: 0d6ce81
Transformer.h
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
//

#pragma once

#include <vector>
#include "DataDeserializer.h"

namespace Microsoft { namespace MSR { namespace CNTK {

class ConfigParameters;

// Defines a set of sequences.
struct Sequences
{
    Sequences()
        : m_endOfEpoch(false)
    {
    }

    // Data for up to a requested number of sequences.
    // Indices in the inner vector have to correspond to the stream IDs
    // given by GetStream().
    std::vector<std::vector<SequenceDataPtr>> m_data;

    // Indicates whether the epoch ends with the data returned.
    bool m_endOfEpoch;
};

class Transformer;
typedef std::shared_ptr<Transformer> TransformerPtr;

// Defines a data transformation interface.
// Transformers are responsible for doing custom transformation of sequences.
// For example for images, there could be scale, crop, or median transformation.
// TODO: Adopt to the C#/Java iterator pattern.
class Transformer
{
public:
    // Initialization.
    virtual void Initialize(
        TransformerPtr next,
        const ConfigParameters& readerConfig) = 0;

    // Describes streams the transformer produces.
    virtual std::vector<StreamDescriptionPtr> GetStreamDescriptions() const = 0;

    // Sets current epoch configuration.
    virtual void StartEpoch(const EpochConfiguration& config) = 0;

    // Gets next sequences up to a maximum count of samples.
    // The return value can be used until the next call to GetNextSequences.
    virtual Sequences GetNextSequences(size_t sampleCount) = 0;

    virtual ~Transformer()
    {
    }
};
} } }
back to top