(a, dtype=None)
return arrays_lib.tensor_to_ndarray(tf.ones_like(a, dtype))
Returns an array of ones with the shape and type of the input array.

  Args:
    a: array_like. Could be an ndarray, a Tensor or any object that can be
      converted to a Tensor using `tf.convert_to_tensor`.
    dtype: Optional, defaults to dtype of the input array. The type of the
      resulting ndarray. Could be a python type, a NumPy type or a TensorFlow
      `DType`.

  Returns:
    An ndarray.
Returns an array of ones with the shape and type of the input array.
Returns an array of ones with the shape and type of the input array .
def ones_like(a, dtype=None):
  """Returns an array of ones with the shape and type of the input array.

  Args:
    a: array_like. Could be an ndarray, a Tensor or any object that can be
      converted to a Tensor using `tf.convert_to_tensor`.
    dtype: Optional, defaults to dtype of the input array. The type of the
      resulting ndarray. Could be a python type, a NumPy type or a TensorFlow
      `DType`.

  Returns:
    An ndarray.
  """
  if isinstance(a, arrays_lib.ndarray):
    a = a.data
  if dtype is None:
    dtype = utils.result_type(a)
  else:
    dtype = utils.result_type(dtype)
  return arrays_lib.tensor_to_ndarray(tf.ones_like(a, dtype))
def ones_like ( a , dtype = None ) : if isinstance ( a , arrays_lib . ndarray ) : a = a . data if dtype is None : dtype = utils . result_type ( a ) else : dtype = utils . result_type ( dtype ) return arrays_lib . tensor_to_ndarray ( tf . ones_like ( a , dtype ) )