Return the weighted norm of ``x``.

        Parameters
        ----------
        x1 : `NumpyTensor`
            Tensor whose norm is calculated.

        Returns
        -------
        norm : float
            The norm of the tensor.
182812
def norm(self, x):
        
        if self.exponent == 2.0:
            return float(np.sqrt(self.const) * _norm_default(x))
        elif self.exponent == float('inf'):
            return float(self.const * _pnorm_default(x, self.exponent))
        else:
            return float((self.const ** (1 / self.exponent) *
                          _pnorm_default(x, self.exponent)))
909770
def orthonormality(V, ip_B=None):
    
    return norm(numpy.eye(V.shape[1]) - inner(V, V, ip_B=ip_B))
1365698
def layer_norm_compute(x, epsilon, scale, bias, layer_collection=None):
  """"""

  # Save these before they get converted to tensors by the casting below
  params = (scale, bias)

  epsilon, scale, bias = [cast_like(t, x) for t in [epsilon, scale, bias]]
  mean = tf.reduce_mean(x, axis=[-1], keepdims=True)
  variance = tf.reduce_mean(
      tf.squared_difference(x, mean), axis=[-1], keepdims=True)
  norm_x = (x - mean) * tf.rsqrt(variance + epsilon)

  output = norm_x * scale + bias


  return output
178673
def compute(self, x_arr, y_arr):
        '''
        
        '''
        return np.linalg.norm(x_arr - y_arr, axis=-1)
77799
def _pnorm_default(x, p):
    """"""
    return np.linalg.norm(x.data.ravel(), ord=p)
517990
def _cost_method(self, *args, **kwargs):
        

        cost_val = np.sum(np.abs(self.weights * self._linear.op(args[0])))

        if 'verbose' in kwargs and kwargs['verbose']:
            print(' - L1 NORM (X):', cost_val)

        return cost_val
178538
def normalize(x):
    ''''''
    x = x.astype(float)
    x -= x.mean()
    return x / float(x.std())
854620
def norm(A):
    
    return np.sqrt(A.multiply(A).sum(1).A1) if issparse(A) else np.sqrt(np.einsum('ij, ij -> i', A, A))
149799
function norm(n, X, incx, offx) {
    // Euclidean norm
    // LAPACK: DNRM2

    if (n === 0.0) {
      return Math.abs(n);
    }

    var scale = 0.0;
    var ssq = 1.0;
    for (var i = 0; i < n; ++i) {
      var xi = X[offx + incx*i];
      if (xi !== 0.0) {
        var absxi = Math.abs(xi);
        if (scale < absxi) {
          var z = scale / absxi;
          ssq = 1.0 + ssq * (z * z);
          scale = absxi;
        } else {
          var z = absxi / scale;
          ssq = ssq + z * z;
        }
      }
    }
    return scale * Math.sqrt(ssq);
  }
1368470
def proximal(self):
        
        if self.pointwise_norm.exponent == np.inf:
            return proximal_convex_conj_l1(space=self.domain)
        elif self.pointwise_norm.exponent == 2:
            return proximal_convex_conj_l1_l2(space=self.domain)
        else:
            raise NotImplementedError('`proximal` only implemented for p = 1 '
                                      'or 2')
239695
def get_template_amplitude_norm(template=None, **kwargs):
    
    input_params = props(template,**kwargs)
    approximant = kwargs['approximant']

    if approximant in _template_amplitude_norms:
        return _template_amplitude_norms[approximant](**input_params)
    else:
        return None
119618
def norm(self):
        
        qr_c = quaternion_conjugate(self._qr)
        qd_c = quaternion_conjugate(self._qd)

        qr_norm = np.linalg.norm(quaternion_multiply(self._qr, qr_c))
        qd_norm = np.linalg.norm(quaternion_multiply(self._qr, qd_c) + quaternion_multiply(self._qd, qr_c))

        return (qr_norm, qd_norm)
1307988
def convert_norm(node, **kwargs):
    
    name, input_nodes, attrs = get_inputs(node, kwargs)

    mx_axis = attrs.get("axis", None)
    axes = convert_string_to_list(str(mx_axis)) if mx_axis else None

    keepdims = get_boolean_attribute_value(attrs, "keepdims")
    ord = int(attrs.get("ord", 2))

    onnx_op_name = "ReduceL1" if ord == 1 else "ReduceL2"

    if axes:
        reduce_node = onnx.helper.make_node(
            onnx_op_name,
            input_nodes,
            [name],
            axes=axes,
            keepdims=keepdims,
            name=name
        )
        return [reduce_node]
    else:
        reduce_node = onnx.helper.make_node(
            onnx_op_name,
            input_nodes,
            [name],
            keepdims=keepdims,
            name=name
        )
        return [reduce_node]
138937
def normalize(v):
    ''''''
    if 0 == np.linalg.norm(v):
        return v
    return v / np.linalg.norm(v)
275200
def norm(self, order=2):
        """"""
        return (sum(val**order for val in abs(self).values()))**(1/order)
631888
def lnprior(self, X):
        
        if np.any(X < self._lower_left) or np.any(X > self._upper_right):
            return -np.inf
        else:
            return 0.0
1053048
def obfn_g1(self, Y1):
        
        """

        return np.linalg.norm((self.Pcn(Y1) - Y1))