Caffe2 - Python API
A deep learning, cross platform ML framework
Public Member Functions | Public Attributes | List of all members
caffe2.python.layers.layers.ModelLayer Class Reference
Inheritance diagram for caffe2.python.layers.layers.ModelLayer:
caffe2.python.layers.adaptive_weight.AdaptiveWeight caffe2.python.layers.add_bias.AddBias caffe2.python.layers.arc_cosine_feature_map.ArcCosineFeatureMap caffe2.python.layers.batch_normalization.BatchNormalization caffe2.python.layers.batch_sigmoid_cross_entropy_loss.BatchSigmoidCrossEntropyLoss caffe2.python.layers.batch_softmax_loss.BatchSoftmaxLoss caffe2.python.layers.blob_weighted_sum.BlobWeightedSum caffe2.python.layers.build_index.MapToRange caffe2.python.layers.constant_weight.ConstantWeight caffe2.python.layers.dropout.Dropout caffe2.python.layers.fc.FC caffe2.python.layers.fc_without_bias.FCWithoutBias caffe2.python.layers.feature_sparse_to_dense.FeatureSparseToDense caffe2.python.layers.gather_record.GatherRecord caffe2.python.layers.homotopy_weight.HomotopyWeight caffe2.python.layers.label_smooth.LabelSmooth caffe2.python.layers.last_n_window_collector.LastNWindowCollector caffe2.python.layers.layer_normalization.LayerNormalization caffe2.python.layers.random_fourier_features.RandomFourierFeatures caffe2.python.layers.reservoir_sampling.ReservoirSampling caffe2.python.layers.sampling_train.SamplingTrain caffe2.python.layers.uniform_sampling.UniformSampling

Public Member Functions

def __init__ (self, model, prefix, input_record, predict_input_record_fields=None, tags=None, kwargs)
 
def get_type (self)
 
def predict_input_record (self)
 
def input_record (self)
 
def predict_output_schema (self)
 
def predict_output_schema (self, output_schema)
 
def output_schema (self)
 
def output_schema (self, output_schema)
 
def get_parameters (self)
 
def get_fp16_compatible_parameters (self)
 
def get_memory_usage (self)
 
def add_init_params (self, init_net)
 
def create_param (self, param_name, shape, initializer, optimizer, ps_param=None, regularizer=None)
 
def get_next_blob_reference (self, name)
 
def add_operators (self, net, init_net=None, context=InstantiationContext.TRAINING)
 
def add_ops (self, net)
 
def add_eval_ops (self, net)
 
def add_train_ops (self, net)
 
def add_ops_to_accumulate_pred (self, net)
 
def add_param_copy_operators (self, net)
 
def export_output_for_metrics (self)
 
def export_params_for_metrics (self)
 

Public Attributes

 name
 
 model
 
 kwargs
 
 request_only
 
 precomputation_request_only
 
 precomputation_object_only
 
 eval_output_schema
 
 tags
 
 params
 

Detailed Description

Definition at line 195 of file layers.py.

Constructor & Destructor Documentation

def caffe2.python.layers.layers.ModelLayer.__init__ (   self,
  model,
  prefix,
  input_record,
  predict_input_record_fields = None,
  tags = None,
  kwargs 
)
Base class for model layers. Layer is an abstraction that allows to
provide model description in terms of meta-operators, where each of the
meta-operators can have different implementations for training,
evaluation and prediction, that are instantiated later. As an example
SampledSoftmax can do something related to sampling depending on
supervision during the training and just apply softmax if it's used for
prediction/evaluation.

All inputs/outputs from layers are represented as a record (instance of
schema bounded to blobs) and are accessible through input_record and
output_schema. If Layer needs to have only a subset of inputs/provides
subset of outputs during the inference - it should provide
predict_input_record and predict_output_schema correspondingly (those
records are expected to be a subset of input_record/output_schema).

Each layer has a list of Tags associated with it, that depends on
current context and arguments. It's possible to use those tags during
the instantiation time.

Definition at line 198 of file layers.py.

Member Function Documentation

def caffe2.python.layers.layers.ModelLayer.add_init_params (   self,
  init_net 
)
Adds layer initialization operators to passed net.

Definition at line 302 of file layers.py.

def caffe2.python.layers.layers.ModelLayer.add_operators (   self,
  net,
  init_net = None,
  context = InstantiationContext.TRAINING 
)
Adds layer trainig or initialization operators to the passed in net.
init_net can be None and can be called independently from add_init_params

Definition at line 354 of file layers.py.

def caffe2.python.layers.layers.ModelLayer.get_fp16_compatible_parameters (   self)
Return a subset of parameters which can be converted to fp16

Definition at line 295 of file layers.py.


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