Apache SINGA
A distributed deep learning platform .
 All Classes Namespaces Files Functions Variables Typedefs Macros
Public Member Functions | Protected Attributes | List of all members
singa::DataLayer Class Reference

Base layer for reading records from local Shard, HDFS, lmdb, etc. More...

#include <input_layer.h>

Inheritance diagram for singa::DataLayer:
singa::InputLayer singa::Layer singa::ShardDataLayer

Public Member Functions

void ComputeGradient (int flag, Metric *perf) override
 Compute gradients for parameters and connected layers. More...
 
Blob< float > * mutable_data (const Layer *layer) override
 
Blob< float > * mutable_grad (const Layer *layer) override
 
ConnectionType dst_layer_connection () const override
 Return the connection type of this layer and all dst layers. More...
 
int batchsize () const
 
virtual const Record & sample () const
 
virtual const std::vector
< Record > & 
records () const
 
- Public Member Functions inherited from singa::Layer
virtual void Setup (const LayerProto &proto, int npartitions=1)
 Setup layer properties. More...
 
virtual void ComputeFeature (int flag, Metric *perf)=0
 Compute features of this layer based on connected layers. More...
 
virtual const std::vector
< Param * > 
GetParams () const
 Layers that have paramters must override this function. More...
 
virtual ConnectionType src_neuron_connection (int k) const
 Return the connection type between one neuron of this layer and its source layer. More...
 
virtual const std::string DebugString (int step, int flag)
 For print debug info about each layer, e.g., norm of feature vector, norm of parameters. More...
 
int partition_dim () const
 
int partition_id () const
 
int type () const
 
const std::string & name () const
 Return name of this layer.
 
virtual const Blob< float > & data (const Layer *from) const
 
virtual const Blob< float > & grad (const Layer *from) const
 
const std::vector< Layer * > srclayers () const
 return LayerS that connected to this layer
 
const std::vector< Layer * > dstlayers () const
 return LayerS that this layer connected to
 
int srclayers_size () const
 
int dstlayers_size () const
 
void clear_dstlayers ()
 
void clear_srclayers ()
 
void add_srclayer (Layer *src)
 
void add_dstlayer (Layer *dst)
 

Protected Attributes

int random_skip_
 
int batchsize_
 
Record sample_
 
std::vector< Record > records_
 
- Protected Attributes inherited from singa::Layer
LayerProto layer_proto_
 
Blob< float > data_
 
Blob< float > grad_
 
std::vector< Layer * > srclayers_
 
std::vector< Layer * > dstlayers_
 

Additional Inherited Members

- Static Public Member Functions inherited from singa::Layer
static LayerCreate (const LayerProto &proto)
 

Detailed Description

Base layer for reading records from local Shard, HDFS, lmdb, etc.

Member Function Documentation

void singa::DataLayer::ComputeGradient ( int  flag,
Metric perf 
)
inlineoverridevirtual

Compute gradients for parameters and connected layers.

Parameters
flagused to get the calling phase, e.g., forward of training (kForward | kTrain)
flagused to get the calling phase, e.g., forward of training

Implements singa::Layer.

ConnectionType singa::DataLayer::dst_layer_connection ( ) const
inlineoverridevirtual

Return the connection type of this layer and all dst layers.

Currently support two connection types: kOneToOne, and kOneToMany. kOneToOne indicates the users implement the ComputeFeature and ComputeGradient function considering only one dest layer. In this case, a SplitLayer will be added automatically to connect this layer with all dest layer. kOneToMany indicates the users has already considered multiple dest layers in the implementation.

Returns
connection type default is kOneToOne.

Reimplemented from singa::Layer.

Blob<float>* singa::DataLayer::mutable_grad ( const Layer from)
inlineoverridevirtual
Returns
a pointer to storing neuron grads of this layer for BP

Reimplemented from singa::Layer.

virtual const std::vector<Record>& singa::DataLayer::records ( ) const
inlinevirtual
Returns
the loaded records

The documentation for this class was generated from the following file: