3 from __future__
import absolute_import
4 from __future__
import division
5 from __future__
import print_function
6 from __future__
import unicode_literals
8 from caffe2.python
import core, schema
9 from caffe2.python.layers.layers
import ModelLayer
10 from caffe2.python.layers.tags
import Tags
19 name='batch_softmax_loss',
22 super(BatchSoftmaxLoss, self).__init__(
23 model, name, input_record, **kwargs)
32 self.tags.update({Tags.TRAIN_ONLY})
37 input_record.prediction.field_type(),
38 model.net.NextScopedBlob(name +
'_softmax')
43 np.float32, model.net.NextScopedBlob(name +
'_loss')
48 def add_ops(self, net):
49 label = self.input_record.label.field_blobs()
50 if self.input_record.label.field_types()[0].base != np.int32:
53 net.NextScopedBlob(
'int32_label'),
54 to=core.DataType.INT32)
58 self.input_record.prediction.field_blobs() + label,
def is_schema_subset(schema, original_schema)