creation
32 memberslucid.creationTensor construction, and the seeding of the default generator.
Thirty entry points: conversion (tensor, as_tensor, from_numpy), filled and *_like constructors, the range builders arange / linspace, the sampling family, the generator controls (seed, get_rng_state / set_rng_state, initial_seed, randperm) and DLPack exchange.
Every constructor takes device=, and passing it is what keeps a pipeline on one device: a helper built without it lands on the CPU and forces a round trip the moment it meets Metal data.
CPU and Metal draw from separate generators, so one seed does not reproduce one stream across both — comparing devices means comparing deterministic ops, or eval() for anything stochastic.
Classes
Functions
tensor→ TensorConstruct a new Tensor from Python data, a NumPy array, or another Tensor.
as_tensor→ TensorConvert data to a tensor, avoiding a copy when the source already matches.
from_numpy→ TensorCopy a NumPy ndarray into an owned Lucid tensor.
zeros→ TensorReturn a tensor filled with the additive identity element, zero.
ones→ TensorReturn a tensor filled with the multiplicative identity element, one.
empty→ TensorReturn a tensor whose elements are uninitialised (undefined memory).
empty_strided→ TensorCreate an uninitialised tensor with the specified size and stride.
full→ TensorReturn a tensor filled with a constant scalar value.
eye→ TensorReturn a 2-D matrix with ones on the main diagonal and zeros elsewhere.
arange→ TensorReturn a 1-D tensor of evenly spaced values over a half-open interval.
linspace→ TensorReturn a 1-D tensor of steps equally spaced values over a closed interval.
zeros_like→ TensorReturn a zero-filled tensor with the same shape, dtype, and device as input.
ones_like→ TensorReturn an all-ones tensor with the same shape, dtype, and device as input.
empty_like→ TensorReturn an uninitialised tensor with the same shape, dtype, and device as input.
full_like→ TensorReturn a constant-filled tensor with the same shape, dtype, and device as input.
logspace→ TensorReturn a 1-D tensor of steps values evenly spaced on a logarithmic scale.
manual_seed→ GeneratorSet the key to seed and rewind the stream to its start.
rand→ TensorReturn a tensor of samples drawn from the continuous uniform distribution.
randn→ TensorReturn a tensor of samples drawn from the standard normal distribution.
randint→ TensorReturn a tensor of samples drawn from the discrete uniform distribution.
bernoulli→ TensorReturn a tensor of independent Bernoulli trials with success probability input.
normal→ TensorReturn a tensor of samples drawn from a parametric normal distribution.
rand_like→ TensorReturn a random tensor with the same shape, dtype, and device as input.
randn_like→ TensorReturn a random tensor with the same shape, dtype, and device as input.
from_dlpack→ TensorConstruct a Lucid tensor from any object exposing the DLPack
protocol (__dlpack__) or from a raw PyCapsule.
get_rng_state→ TensorSnapshot the full state of the default random generator.
initial_seed→ intReturn the seed (key) of the default generator as it was last set.
randperm→ TensorReturn a uniformly random permutation of the integers .
seed→ intSeed the default generator from the OS cryptographic entropy source.
set_rng_state→ NoneRestore the default random generator to a previously captured state.
to_dlpack→ objectExport tensor as a DLPack PyCapsule.