Creation#
Array creation and initialization operations.
- nabla.ops.creation.array(data, dtype=<MagicMock name='mock.float32' id='140511747156224'>, device=max.driver.CPU, batch_dims=(), traced=False)[source]#
Create an array from Python list, numpy array, or scalar value.
- nabla.ops.creation.arange(start, stop=None, step=None, dtype=<MagicMock name='mock.float32' id='140511747156224'>, device=max.driver.CPU, traced=False, batch_dims=())[source]#
Return evenly spaced values within a given interval.
This function follows the JAX/NumPy arange API.
- Parameters:
start (int | float) – Start of interval. The interval includes this value.
stop (int | float | None) – End of interval. The interval does not include this value. If None, the range is [0, start).
step (int | float | None) – Spacing between values. The default step size is 1.
dtype (<MagicMock id='140511747549008'>) – The data type of the output array.
device (max.driver.Device) – The device to place the array on.
traced (bool) – Whether the operation should be traced in the graph.
- Returns:
A 1D array of evenly spaced values.
- Return type:
- nabla.ops.creation.ndarange(shape, dtype=<MagicMock name='mock.float32' id='140511747156224'>, device=max.driver.CPU, batch_dims=(), traced=False)[source]#
Create an array with values from 0 to prod(shape)-1 reshaped to given shape.
- nabla.ops.creation.ndarange_like(template)[source]#
Create an array with values from 0 to prod(template.shape)-1 reshaped to template’s shape.
- nabla.ops.creation.randn(shape, dtype=<MagicMock name='mock.float32' id='140511747156224'>, mean=0.0, std=1.0, device=max.driver.CPU, seed=0, batch_dims=(), traced=False)[source]#
Create array with normally distributed random values.
- nabla.ops.creation.randn_like(template, mean=0.0, std=1.0, seed=0)[source]#
Create an array with normally distributed random values like the template.
- nabla.ops.creation.rand(shape, dtype=<MagicMock name='mock.float32' id='140511747156224'>, lower=0.0, upper=1.0, device=max.driver.CPU, seed=0, batch_dims=(), traced=False)[source]#
Create array with uniformly distributed random values.
- nabla.ops.creation.rand_like(template, lower=0.0, upper=1.0, seed=0)[source]#
Create an array with uniformly distributed random values like the template.
- nabla.ops.creation.zeros(shape, dtype=<MagicMock name='mock.float32' id='140511747156224'>, device=max.driver.CPU, batch_dims=(), traced=False)[source]#
Create an array filled with zeros.
- nabla.ops.creation.ones(shape, dtype=<MagicMock name='mock.float32' id='140511747156224'>, device=max.driver.CPU, batch_dims=(), traced=False)[source]#
Create an array filled with ones.
- nabla.ops.creation.zeros_like(template)[source]#
Create an array of zeros with the same shape, dtype, and device as template.
- nabla.ops.creation.ones_like(template)[source]#
Create an array of ones with the same shape, dtype, and device as template.
- nabla.ops.creation.full_like(template, fill_value)[source]#
Create an array filled with a specific value, with the same shape, dtype, and device as template.
- nabla.ops.creation.xavier_uniform(shape, dtype=<MagicMock name='mock.float32' id='140511747156224'>, gain=1.0, device=max.driver.CPU, seed=0, batch_dims=(), traced=False)[source]#
Xavier/Glorot uniform initialization for sigmoid/tanh activations.
Samples from uniform distribution U(-a, a) where a = gain * sqrt(6 / (fan_in + fan_out))
- nabla.ops.creation.xavier_normal(shape, dtype=<MagicMock name='mock.float32' id='140511747156224'>, gain=1.0, device=max.driver.CPU, seed=0, batch_dims=(), traced=False)[source]#
Xavier/Glorot normal initialization for sigmoid/tanh activations.
Samples from normal distribution N(0, std²) where std = gain * sqrt(2 / (fan_in + fan_out))
- nabla.ops.creation.he_uniform(shape, dtype=<MagicMock name='mock.float32' id='140511747156224'>, device=max.driver.CPU, seed=0, batch_dims=(), traced=False)[source]#
He uniform initialization for ReLU activations.
Samples from uniform distribution U(-a, a) where a = sqrt(6 / fan_in)
- nabla.ops.creation.he_normal(shape, dtype=<MagicMock name='mock.float32' id='140511747156224'>, device=max.driver.CPU, seed=0, batch_dims=(), traced=False)[source]#
He normal initialization for ReLU activations.
Samples from normal distribution N(0, std²) where std = sqrt(2 / fan_in)
- nabla.ops.creation.lecun_uniform(shape, dtype=<MagicMock name='mock.float32' id='140511747156224'>, device=max.driver.CPU, seed=0, batch_dims=(), traced=False)[source]#
LeCun uniform initialization for SELU activations.
Samples from uniform distribution U(-a, a) where a = sqrt(3 / fan_in)
- nabla.ops.creation.lecun_normal(shape, dtype=<MagicMock name='mock.float32' id='140511747156224'>, device=max.driver.CPU, seed=0, batch_dims=(), traced=False)[source]#
LeCun normal initialization for SELU activations.
Samples from normal distribution N(0, std²) where std = sqrt(1 / fan_in)
- nabla.ops.creation.glorot_uniform(shape, dtype=<MagicMock name='mock.float32' id='140511747156224'>, gain=1.0, device=max.driver.CPU, seed=0, batch_dims=(), traced=False)[source]#
Glorot/Xavier uniform initialization for sigmoid/tanh activations.
Samples from uniform distribution U(-a, a) where a = sqrt(6 / (fan_in + fan_out))