cupy.ones_like

cupy.ones_like(a, dtype=None)[source]

Returns an array of ones with same shape and dtype as a given array.

This function currently does not support order and subok options.

Parameters:
  • a (cupy.ndarray) – Base array.
  • dtype – Data type specifier. The dtype of a is used by default.
Returns:

An array filled with ones.

Return type:

cupy.ndarray