Skip to content
fn

sign_storage

→Storage
int sign_storage(const int & s, int numel, Dtype dt, Device device)

Element-wise sign function: returns -1, 0, or +1.

Parameters

sconst Storage&
Input buffer.
numelstd::size_t
Number of elements.
dtDtype
Element dtype.
deviceDevice
Target device.

Returns

Storage

New storage with values in {-1, 0, +1} matching the sign of s.