Skip to content
fn

ones_op

→TensorImplPtr
int ones_op(const int & shape, Dtype dt, Device device, bool requires_grad)

Python wrappers

Public Python APIs implemented by this engine symbol.

Create a tensor of the given shape filled with ones.

Parameters

shapeShape
Desired output shape.
dtDtype
Element dtype.
deviceDevice
Target device.
requires_gradbool
Attach a fresh autograd leaf when true.

Returns

TensorImplPtr

Leaf tensor of the specified shape filled with 11.