Skip to content
fn

empty_op

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

Python wrappers

Public Python APIs implemented by this engine symbol.

Create an uninitialised tensor of the given shape.

Parameters

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

Returns

TensorImplPtr

Leaf tensor with unspecified content.

Notes

The current implementation zero-fills (via make_zero_storage) to avoid UB on uninitialised reads. The empty name signals that callers must not rely on the values — future implementations may switch to a true uninitialised allocator.