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

The neural network is constructed from user configurations in NetProto. More...

#include <neuralnet.h>

Public Member Functions

 NeuralNet (NetProto netproto, int npartitions=1)
 construct the net structure from protocol buffer. More...
 
std::string ToAdjacency ()
 To display the adjacency layers.
 
void ShareParamsFrom (shared_ptr< NeuralNet > other)
 Share memory of parameter values from other neuralnet.
 
const std::vector< Layer * > & layers ()
 
const std::vector< ParserLayer * > & parserlayers () const
 
const std::vector< LossLayer * > & losslayers () const
 
const std::vector< DataLayer * > & datalayers () const
 
const std::vector< Param * > & params () const
 
Layername2layer (string name) const
 
Paramparamid2param (int id) const
 

Static Public Member Functions

static shared_ptr< NeuralNetCreate (const NetProto &np, Phase phase, int num)
 Create the neural network for training, test or validation. More...
 

Protected Member Functions

GraphCreateGraph (const NetProto &netproto, int npartitions)
 Create a neural net graph, one node for each layer. More...
 
void CreateNetFromGraph (Graph *graph, int npartitions)
 Create neural net from graph, one layer per node.
 
void PrepareDataStructures ()
 prepare data structures, e.g., params_, layers_, etc.
 

Protected Attributes

vector< Layer * > layers_
 
vector< ParserLayer * > parserlayers_
 
vector< LossLayer * > losslayers_
 
vector< DataLayer * > datalayers_
 
vector< Param * > params_
 
map< string, Layer * > name2layer_
 
map< int, Param * > paramid2param_
 

Detailed Description

The neural network is constructed from user configurations in NetProto.

Some layers, e.g., SplitLayer and BridgeSrcLayer/BridgeDstLayer will be added implicitly to partition the neural network. TODO create wrappers for popular models, e.g., MLP, CNN.

Constructor & Destructor Documentation

singa::NeuralNet::NeuralNet ( NetProto  netproto,
int  npartitions = 1 
)
explicit

construct the net structure from protocol buffer.

Parameters
netprotoneural net config
npartitionsnum of partitions. 1 for no partitioning.

Member Function Documentation

static shared_ptr<NeuralNet> singa::NeuralNet::Create ( const NetProto &  np,
Phase  phase,
int  num 
)
static

Create the neural network for training, test or validation.

Parameters for test/validation net can share those from training after setup (done outside of this funcion).

Parameters
npproto for the neural network
phasetest/training/validation
numnum of partitions, do partitioning if num > 1
Returns
shared pointer to a neural net
Graph* singa::NeuralNet::CreateGraph ( const NetProto &  netproto,
int  npartitions 
)
protected

Create a neural net graph, one node for each layer.

Partition the graph if npartitions > 1, each layer is sliced according to its own partition setting.

Parameters
netproto
Returns
neural net graph

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