original_docstring: Equivalent to tf.nn.softmax but works around b/70297725.
docstring: Equivalent to tf.nn.softmax but works around b/70297725.
docstring_tokens: Equivalent to tf . nn . softmax but works around b / 70297725 .
code: def softmax(x, axis, name=None):
    """Equivalent to tf.nn.softmax but works around b/70297725."""
    with ops.name_scope(name, "softmax", [x, axis]):
      x = ops.convert_to_tensor(x, name="x")
      ndims = (x.shape.ndims if x.shape.ndims is not None
               else array_ops.rank(x, name="ndims"))
      axis = ops.convert_to_tensor(axis, dtype=dtypes.int32, name="axis")
      axis_ = tensor_util.constant_value(axis)
      if axis_ is not None:
        axis = np.int(ndims + axis_ if axis_ < 0 else axis_)
      else:
        axis = array_ops.where(axis < 0, ndims + axis, axis)
    return nn_ops.softmax(x, axis=axis)
code_tokens: def softmax ( x , axis , name = None ) : with ops . name_scope ( name , "softmax" , [ x , axis ] ) : x = ops . convert_to_tensor ( x , name = "x" ) ndims = ( x . shape . ndims if x . shape . ndims is not None else array_ops . rank ( x , name = "ndims" ) ) axis = ops . convert_to_tensor ( axis , dtype = dtypes . int32 , name = "axis" ) axis_ = tensor_util . constant_value ( axis ) if axis_ is not None : axis = np . int ( ndims + axis_ if axis_ < 0 else axis_ ) else : axis = array_ops . where ( axis < 0 , ndims + axis , axis ) return nn_ops . softmax ( x , axis = axis )
short_docstring: Equivalent to tf.nn.softmax but works around b/70297725.
short_docstring_tokens: Equivalent to tf . nn . softmax but works around b / 70297725 .
comment: """Equivalent to tf.nn.softmax but works around b/70297725."""