Skip to main content

NDArray::ones

public static function ones(array $shape): NDArray;

The function creates a new NDArray with the specified shape, filled with ones.


Parameters

$shape

Type array[long,]

  • The shape parameter can be a sequence of integers, indicating the dimensions of the array

Return

Type - NDArray

  • Return an array of shape $shape filles with ones.