parameters: (x, _ord, axis, keepdims)
return_statement: return res
docstring: Returns norm of a vector.
docstring_summary: Returns norm of a vector.
docstring_tokens: Returns norm of a vector .
function: def _vector_norm(x, _ord, axis, keepdims):
      """Returns norm of a vector."""
      if _in(_ord, ('fro', 'nuc')):
          _raise_value_error('Frobenius norm and nuclear norm are only defined for vectors')
      if _ord is None:
          _ord = 2
      if _ord == inf:
          res = P.ReduceMax(keepdims)(absolute(x), axis)
      elif _ord == -inf:
          res = P.ReduceMin(keepdims)(absolute(x), axis)
      elif _ord == 0:
          res = P.ReduceSum(keepdims)(F.not_equal(x, 0).astype(mstype.float32), axis)
      else:
          res = power(P.ReduceSum(keepdims)(power(absolute(x), _ord), axis), 1./_ord)
      return res
function_tokens: def _vector_norm ( x , _ord , axis , keepdims ) : if _in ( _ord , ( 'fro' , 'nuc' ) ) : _raise_value_error ( 'Frobenius norm and nuclear norm are only defined for vectors' ) if _ord is None : _ord = 2 if _ord == inf : res = P . ReduceMax ( keepdims ) ( absolute ( x ) , axis ) elif _ord == - inf : res = P . ReduceMin ( keepdims ) ( absolute ( x ) , axis ) elif _ord == 0 : res = P . ReduceSum ( keepdims ) ( F . not_equal ( x , 0 ) . astype ( mstype . float32 ) , axis ) else : res = power ( P . ReduceSum ( keepdims ) ( power ( absolute ( x ) , _ord ) , axis ) , 1. / _ord ) return res