Exemplo n.º 1
0
 def Setup(self, bottom):
     super(NormalizeLayer, self).Setup(bottom)
     norm_out = [ops.L2Norm(bottom[0], **self._l2norm_param)]
     scale_out = ops.Scale(
         norm_out + [blob['data'] for blob in self.scale_blobs],
         **self._scale_param)
     return scale_out
Exemplo n.º 2
0
def l2_normalize(
    x,
    dim,
    epsilon=1e-12,
    name=None,
):
    return _ops.L2Norm(
        x,
        axis=dim,
        num_axes=1,
        eps=epsilon,
        name=name,
    )
Exemplo n.º 3
0
 def LayerSetup(self, bottom):
     norm_out = [_ops.L2Norm(bottom, **self.l2norm_arguments)]
     norm_out += [blob['data'] for blob in self._blobs]
     return _ops.Affine(norm_out, **self.affine_arguments)
Exemplo n.º 4
0
def l2_normalize(x, dim, epsilon=1e-12, name=None):
    return ops.L2Norm(inputs=x, axis=dim, num_axes=1, eps=epsilon)