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 (
16 def __init__(self, model, input_record, name='dot_product', **kwargs):
17 super(DotProduct, self).__init__(model, name, input_record, **kwargs)
19 "Incorrect input type. Excpected Struct, but received: {0}".\
21 assert len(input_record.get_children()) == 2, (
22 "DotProduct accept 2 inputs")
23 assert len(set(input_record.field_types())) == 1, (
24 "Inputs should be of the same field type")
26 for field_name, field_type
in input_record.fields.items():
28 "Incorrect input type for {}. Excpected Scalar, but got: {}".\
29 format(field_name, field_type)
32 (input_record.field_types()[0].base, ()),
33 model.net.NextScopedBlob(name +
'_output'))
35 def add_ops(self, net):