3 from __future__
import absolute_import
4 from __future__
import division
5 from __future__
import print_function
6 from __future__
import unicode_literals
12 def _elementwise_linear(
13 model, op_call, blob_in, blob_out, dim,
14 weight_init=
None, bias_init=
None, **kwargs
16 """Elementwise_Linear""" 17 weight_init = weight_init
or (
'ConstantFill', {
'value': 1.0})
18 bias_init = bias_init
or (
'ConstantFill', {
'value': 0.0})
19 blob_out = blob_out
or model.net.NextName()
21 weight = model.param_init_net.__getattr__(weight_init[0])(
27 bias = model.param_init_net.__getattr__(bias_init[0])(
34 weight = core.ScopedBlobReference(
35 blob_out +
'_w', model.param_init_net)
36 bias = core.ScopedBlobReference(
37 blob_out +
'_b', model.param_init_net)
39 model.AddParameter(weight, ParameterTags.WEIGHT)
40 model.AddParameter(bias, ParameterTags.BIAS)
41 return op_call([blob_in, weight, bias], blob_out, **kwargs)
45 return _elementwise_linear(
46 model, model.net.ElementwiseLinear, *args, **kwargs)
Module caffe2.python.helpers.elementwise_linear.