parameters: (tensor, dtype, name, optimize=True)
docstring: Internal implementation for the v1/v2 ones_like API calls.
docstring_summary: Internal implementation for the v1/v2 ones_like API calls.
docstring_tokens: Internal implementation for the v1 / v2 ones_like API calls .
function: def ones_like_impl(tensor, dtype, name, optimize=True):
    """Internal implementation for the v1/v2 ones_like API calls."""
    with ops.name_scope(name, "ones_like", [tensor]) as name:
      tensor = ops.convert_to_tensor(tensor, name="tensor")
      ones_shape = shape_internal(tensor, optimize=optimize)
      if dtype is None:
        dtype = tensor.dtype
      ret = ones(ones_shape, dtype=dtype, name=name)
      if not context.executing_eagerly():
        ret.set_shape(tensor.get_shape())
      return ret
function_tokens: def ones_like_impl ( tensor , dtype , name , optimize = True ) : with ops . name_scope ( name , "ones_like" , [ tensor ] ) as name : tensor = ops . convert_to_tensor ( tensor , name = "tensor" ) ones_shape = shape_internal ( tensor , optimize = optimize ) if dtype is None : dtype = tensor . dtype ret = ones ( ones_shape , dtype = dtype , name = name ) if not context . executing_eagerly ( ) : ret . set_shape ( tensor . get_shape ( ) ) return ret