Skip to content
fn

make_ones_storage

→Storage
int make_ones_storage(const int & shape, Dtype dtype, Device device)

Allocate a ones-filled Storage on the requested device.

Used by Engine::backward as the default seed gradient when the caller does not supply an explicit grad argument.

Parameters

shapeconst Shape&
N-D shape of the resulting storage.
dtypeDtype
Element dtype.
deviceDevice
Target device.

Returns

Storage

Storage with every element equal to one.