3 from __future__
import absolute_import
4 from __future__
import division
5 from __future__
import print_function
6 from __future__
import unicode_literals
24 name=
'fc_without_bias',
27 super(FCWithoutBias, self).__init__(model, name, input_record, **kwargs)
28 assert isinstance(input_record,
schema.Scalar),
"Incorrect input type" 29 assert len(input_record.field_types()[0].shape) > 0, (
30 "FCWithoutBias expects limited dimensions of the input tensor" 33 input_dims = input_record.field_types()[0].shape[0]
34 assert input_dims > 0, (
35 "FCWithoutBias expects input dimensions > 0, got {}".format(input_dims)
39 (np.float32, (output_dims, )),
43 scale = math.sqrt(1.0 / input_dims)
44 weight_init = weight_init
if weight_init
else (
45 'UniformFill', {
'min': -scale,
50 shape=[output_dims, input_dims],
51 initializer=weight_init,
52 optimizer=weight_optim)
54 def _add_ops(self, net, params):
56 self.input_record.field_blobs() + params,
57 self.output_schema.field_blobs(), trans_b=1, **self.
kwargs 61 def param_blobs(self):
def get_next_blob_reference(self, name)
def create_param(self, param_name, shape, initializer, optimizer, ps_param=None, regularizer=None)