Array Creation#

Functions for creating new arrays with various initialization patterns.

Quick Reference#

arange#

nabla.arange(start: 'int | float', stop: 'int | float | None' = None, step: 'int | float | None' = None, dtype: 'DType' = float32, device: 'Device' = Device(type=cpu,id=0), traced: 'bool' = False, batch_dims: 'Shape' = ()) -> 'Array'

Create an array with evenly spaced values.

array#

nabla.array(data: 'list | np.ndarray | float | int', dtype: 'DType' = float32, device: 'Device' = Device(type=cpu,id=0), batch_dims: 'Shape' = (), traced: 'bool' = False) -> 'Array'

Create a new array from data.

full_like#

nabla.full_like(template: 'Array', fill_value: 'float') -> 'Array'

Nabla operation: full_like

glorot_uniform#

nabla.glorot_uniform(shape: 'Shape', dtype: 'DType' = float32, gain: 'float' = 1.0, device: 'Device' = Device(type=cpu,id=0), seed: 'int' = 0, batch_dims: 'Shape' = (), traced: 'bool' = False) -> 'Array'

Nabla operation: glorot_uniform

he_normal#

nabla.he_normal(shape: 'Shape', dtype: 'DType' = float32, device: 'Device' = Device(type=cpu,id=0), seed: 'int' = 0, batch_dims: 'Shape' = (), traced: 'bool' = False) -> 'Array'

Nabla operation: he_normal

he_uniform#

nabla.he_uniform(shape: 'Shape', dtype: 'DType' = float32, device: 'Device' = Device(type=cpu,id=0), seed: 'int' = 0, batch_dims: 'Shape' = (), traced: 'bool' = False) -> 'Array'

Nabla operation: he_uniform

lecun_normal#

nabla.lecun_normal(shape: 'Shape', dtype: 'DType' = float32, device: 'Device' = Device(type=cpu,id=0), seed: 'int' = 0, batch_dims: 'Shape' = (), traced: 'bool' = False) -> 'Array'

Nabla operation: lecun_normal

lecun_uniform#

nabla.lecun_uniform(shape: 'Shape', dtype: 'DType' = float32, device: 'Device' = Device(type=cpu,id=0), seed: 'int' = 0, batch_dims: 'Shape' = (), traced: 'bool' = False) -> 'Array'

Nabla operation: lecun_uniform

ndarange#

nabla.ndarange(shape: 'Shape', dtype: 'DType' = float32, device: 'Device' = Device(type=cpu,id=0), batch_dims: 'Shape' = (), traced: 'bool' = False) -> 'Array'

Nabla operation: ndarange

ndarange_like#

nabla.ndarange_like(template: 'Array') -> 'Array'

Nabla operation: ndarange_like

ones#

nabla.ones(shape: 'Shape', dtype: 'DType' = float32, device: 'Device' = Device(type=cpu,id=0), batch_dims: 'Shape' = (), traced: 'bool' = False) -> 'Array'

Create an array filled with ones.

ones_like#

nabla.ones_like(template: 'Array') -> 'Array'

Create an array of ones with the same shape as input.

rand#

nabla.rand(shape: 'Shape', dtype: 'DType' = float32, lower: 'float' = 0.0, upper: 'float' = 1.0, device: 'Device' = Device(type=cpu,id=0), seed: 'int' = 0, batch_dims: 'Shape' = (), traced: 'bool' = False) -> 'Array'

Nabla operation: rand

rand_like#

nabla.rand_like(template: 'Array', lower: 'float' = 0.0, upper: 'float' = 1.0, seed: 'int' = 0) -> 'Array'

Nabla operation: rand_like

randn#

nabla.randn(shape: 'Shape', dtype: 'DType' = float32, mean: 'float' = 0.0, std: 'float' = 1.0, device: 'Device' = Device(type=cpu,id=0), seed: 'int' = 0, batch_dims: 'Shape' = (), traced: 'bool' = False) -> 'Array'

Create an array with random values from normal distribution.

randn_like#

nabla.randn_like(template: 'Array', mean: 'float' = 0.0, std: 'float' = 1.0, seed: 'int' = 0) -> 'Array'

Nabla operation: randn_like

triu#

nabla.triu(x, k=0)

Nabla operation: triu

xavier_normal#

nabla.xavier_normal(shape: 'Shape', dtype: 'DType' = float32, gain: 'float' = 1.0, device: 'Device' = Device(type=cpu,id=0), seed: 'int' = 0, batch_dims: 'Shape' = (), traced: 'bool' = False) -> 'Array'

Nabla operation: xavier_normal

xavier_uniform#

nabla.xavier_uniform(shape: 'Shape', dtype: 'DType' = float32, gain: 'float' = 1.0, device: 'Device' = Device(type=cpu,id=0), seed: 'int' = 0, batch_dims: 'Shape' = (), traced: 'bool' = False) -> 'Array'

Nabla operation: xavier_uniform

zeros#

nabla.zeros(shape: 'Shape', dtype: 'DType' = float32, device: 'Device' = Device(type=cpu,id=0), batch_dims: 'Shape' = (), traced: 'bool' = False) -> 'Array'

Create an array filled with zeros.

zeros_like#

nabla.zeros_like(template: 'Array') -> 'Array'

Create a zero array with the same shape as input.