ones_like(x, dtype_str=None, dev_str=None, f=None)¶
Returns an array of ones with the same shape and type as x, unless dtype_str provided which overrides.
x (array) – The shape and data-type of a define these same attributes of the returned array.
dtype_str (data-type string, optional) – The desired data-type for the array in string format, i.e. ‘float32’ or ‘int64’. If not given, then the type of the original array is used.
dev_str (str, optional) – device on which to create the array ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc. Same as x if None.
f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.
Tensor of zeros with the same shape and type as a, unless dtype_str provided which overrides.