Apache SINGA
A distributed deep learning platform .
|
The neural network is constructed from user configured layers through google protocol buffer. More...
#include <neuralnet.h>
Public Member Functions | |
NeuralNet (NetProto net_proto, int group_size=1) | |
construct the net structure from protocol buffer. | |
std::string | ToString () |
construct a json string representing the neuralnet graph. More... | |
string | DebugInfo () |
Print Norm1 of data and grad of each Layer and parameter. More... | |
std::string | ToAdjacency () |
to display the adjacency layers | |
void | AddLayer (const LayerProto &layer_proto) |
Add layer explicitly used in manually programming/constructing neural net. | |
void | AddLayer (const Layer *layer) |
Add layer explicitly used in manually programming/constructing neural net. | |
void | ShareParams (shared_ptr< NeuralNet > other, int flag) |
share weights from other neuralnet | |
void | ToProto (NetProto *net_proto, bool copyData=false) |
const std::vector< shared_ptr < Layer > > & | layers () |
const std::vector< ParserLayer * > & | parserlayers () |
return ParserLayer of the neuralnet. | |
const std::vector< LossLayer * > & | losslayers () |
const std::vector< DataLayer * > & | datalayers () |
const std::vector< shared_ptr < Param > > & | params () const |
shared_ptr< Layer > | name2layer (string name) |
shared_ptr< Param > | paramid2param (int id) |
Static Public Member Functions | |
static void | RegisterLayers () |
Register Layers. | |
static shared_ptr< NeuralNet > | SetupNeuralNet (const NetProto &np, Phase phase, int group_size) |
Setup the neural network for training, test or validation. More... | |
Protected Member Functions | |
void | ConstructNeuralNet (const NetProto &net_proto) |
void | PartitionNeuralNet () |
map< string, shared_ptr< Layer > > | GetNameToLayer (const vector< shared_ptr< Layer >> &layers) |
Graph | CreatePartitonedGraph (const vector< shared_ptr< Layer >> &layers, const map< string, shared_ptr< Layer >> &name2layer) |
map< string, vector < shared_ptr< Layer > > > | PartitionLayers (const vector< shared_ptr< Layer >> &layers) |
Partition each layer according its partition type and dimension. More... | |
Protected Attributes | |
vector< shared_ptr< Layer > > | layers_ |
vector< ParserLayer * > | parserlayers_ |
vector< LossLayer * > | losslayers_ |
vector< DataLayer * > | datalayers_ |
vector< shared_ptr< Param > > | params_ |
map< string, shared_ptr< Layer > > | name2layer_ |
map< int, shared_ptr< Param > > | paramid2param_ |
map< string, LayerProto > | name2layerproto_ |
int | group_size_ |
Graph | graph_ |
The neural network is constructed from user configured layers through google protocol buffer.
TODO support constructing neural network by adding layers explicitly. E.g., users create layers and connect them manually in the code.
Some layers, e.g., SplitLayer and BridgeSrcLayer/BridgeDstLayer will be added implicitly to partition the neural network.
string singa::NeuralNet::DebugInfo | ( | ) |
Print Norm1 of data and grad of each Layer and parameter.
net,neural | network |
|
protected |
Partition each layer according its partition type and dimension.
layers | original unpartitioned layers |
|
static |
Setup 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).
np | proto for the neural network. |
phase | test/training/validation |
group_size | partition the net among this num of workers |
std::string singa::NeuralNet::ToString | ( | ) |
construct a json string representing the neuralnet graph.
The json string can be used by other graph engine to draw a figure for displaying the neuralnet structure.