Example #1
0
    def __init__(self,
                 activation=None,
                 weight_initializer='xavier_normal',
                 use_bias=True,
                 bias_initializer='zeros',
                 layer_normalization=False,
                 **kwargs):

        # Call parent's constructor
        NeuroBase.__init__(self, activation, weight_initializer, use_bias,
                           bias_initializer, layer_normalization, **kwargs)
        self._activation_string = activation
Example #2
0
    def __init__(self,
                 activation=None,
                 weight_initializer='xavier_normal',
                 use_bias=True,
                 bias_initializer='zeros',
                 **kwargs):

        # Call parent's constructor
        NeuroBase.__init__(self, activation, weight_initializer, use_bias,
                           bias_initializer, **kwargs)

        # Common attributes
        self._activation_string = activation
        self._output_dim = None
        self.tensors_to_export = OrderedDict()
Example #3
0
 def _link(self, x):
   return NeuroBase.layer_normalize(
     x=x,
     axis=self.axis,
     center=self.center,
     scale=self.scale,
     beta_initializer=self.beta_initializer,
     gamma_initializer=self.gamma_initializer,
     epsilon=self.epsilon)
Example #4
0
    def layer_normalization(a, gain_initializer, use_bias=False):
        from tframe.operators.apis.neurobase import NeuroBase

        assert not use_bias
        gain_initializer = initializers.get(gain_initializer)
        return NeuroBase.layer_normalize(a,
                                         axis=1,
                                         center=False,
                                         gamma_initializer=gain_initializer)