Documentation
¶
Index ¶
- func NewCpuDevice[T kernels.D]() candy.BackendDevice[T]
- type CpuDevice
- func (c *CpuDevice[T]) Alloc(shape *candy.Shape, dtype candy.DType) (candy.BackendStorage[T], error)
- func (c *CpuDevice[T]) Full(shape *candy.Shape, dtype candy.DType, value float64) (candy.BackendStorage[T], error)
- func (c *CpuDevice[T]) IsSame(other candy.BackendDevice[T]) bool
- func (c *CpuDevice[T]) Location() candy.DeviceLocation
- func (c *CpuDevice[T]) Ones(shape *candy.Shape, dtype candy.DType) (candy.BackendStorage[T], error)
- func (c *CpuDevice[T]) RandNormal(shape *candy.Shape, dtype candy.DType, mean, std float64) (candy.BackendStorage[T], error)
- func (c *CpuDevice[T]) RandUniform(shape *candy.Shape, dtype candy.DType, min, max float64) (candy.BackendStorage[T], error)
- func (c *CpuDevice[T]) SetSeed(seed uint64) error
- func (c *CpuDevice[T]) StorageFromCpuStorage(s *CpuStorage[T]) (candy.BackendStorage[T], error)
- func (c *CpuDevice[T]) StorageFromSlice(data []T) (candy.BackendStorage[T], error)
- func (c *CpuDevice[T]) Synchronize() error
- func (c *CpuDevice[T]) Zeros(shape *candy.Shape, dtype candy.DType) (candy.BackendStorage[T], error)
- type CpuStorage
- func (s *CpuStorage[T]) Abs(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Add(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Affine(layout *candy.Layout, scale, bias T) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Argmax(layout *candy.Layout, dim int) (candy.BackendStorage[uint32], error)
- func (s *CpuStorage[T]) Argmin(layout *candy.Layout, dim int) (candy.BackendStorage[uint32], error)
- func (s *CpuStorage[T]) AvgPool2d(layout *candy.Layout, kH, kW, sH, sW int) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) CastFromF32(numel int, layout *candy.Layout, dtype candy.DType) (any, error)
- func (s *CpuStorage[T]) CastFromF64(numel int, layout *candy.Layout, dtype candy.DType) (any, error)
- func (s *CpuStorage[T]) CastFromI64(numel int, layout *candy.Layout, dtype candy.DType) (any, error)
- func (s *CpuStorage[T]) CastFromU8(numel int, layout *candy.Layout, dtype candy.DType) (any, error)
- func (s *CpuStorage[T]) CastFromU32(numel int, layout *candy.Layout, dtype candy.DType) (any, error)
- func (s *CpuStorage[T]) Ceil(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Clone() (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) ConstSet(layout *candy.Layout, val T) error
- func (s *CpuStorage[T]) Conv1d(layout *candy.Layout, kernel candy.BackendStorage[T], ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Conv2d(layout *candy.Layout, kernel candy.BackendStorage[T], ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) ConvTranspose1d(layout *candy.Layout, kernel candy.BackendStorage[T], ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) ConvTranspose2d(layout *candy.Layout, kernel candy.BackendStorage[T], ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Copy(layout *candy.Layout, src candy.BackendStorage[T]) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Copy2d(dst candy.BackendStorage[T], d1, d2 int, ...) error
- func (s *CpuStorage[T]) Cos(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) DType() candy.DType
- func (s *CpuStorage[T]) Data() []T
- func (s *CpuStorage[T]) Device() candy.BackendDevice[T]
- func (s *CpuStorage[T]) Div(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Elu(layout *candy.Layout, alpha T) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Eq(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) EqU8(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[uint8], error)
- func (s *CpuStorage[T]) Erf(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Exp(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) FastArgmax(layout *candy.Layout) (candy.BackendStorage[uint32], error)
- func (s *CpuStorage[T]) FastArgmin(layout *candy.Layout) (candy.BackendStorage[uint32], error)
- func (s *CpuStorage[T]) FastLayerNorm(layout *candy.Layout, alpha candy.BackendStorage[T], alphaLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) FastMax(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) FastMin(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) FastRmsNorm(layout *candy.Layout, alpha candy.BackendStorage[T], alphaLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) FastSoftmax(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) FastSum(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Floor(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Gather(layout *candy.Layout, ids candy.BackendStorage[T], idsLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Ge(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) GeU8(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[uint8], error)
- func (s *CpuStorage[T]) Gelu(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) GeluErf(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Gt(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) GtU8(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[uint8], error)
- func (s *CpuStorage[T]) Le(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) LeU8(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[uint8], error)
- func (s *CpuStorage[T]) Log(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Lt(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) LtU8(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[uint8], error)
- func (s *CpuStorage[T]) MatMul(lhsLayout *candy.Layout, rhs candy.BackendStorage[T], rhsLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Max(layout *candy.Layout, dim int) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) MaxPool2d(layout *candy.Layout, kH, kW, sH, sW int) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Maximum(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Min(layout *candy.Layout, dim int) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Minimum(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Mul(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Ne(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) NeU8(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[uint8], error)
- func (s *CpuStorage[T]) Neg(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Normcdf(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Powf(layout *candy.Layout, param T) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Recip(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Relu(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Rope(layout *candy.Layout, cos candy.BackendStorage[T], cosLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) RopeI(layout *candy.Layout, cos candy.BackendStorage[T], cosLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) RopeThd(layout *candy.Layout, cos candy.BackendStorage[T], cosLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Round(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Scatter(layout *candy.Layout, ids candy.BackendStorage[T], idsLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) ScatterAdd(layout *candy.Layout, ids candy.BackendStorage[T], idsLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Sigmoid(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Sign(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Silu(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Sin(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Sqr(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Sqrt(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Sub(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Sum(layout *candy.Layout, dims []int) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) Tanh(layout *candy.Layout) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) ToDtype(layout *candy.Layout, dtype candy.DType) (any, error)
- func (s *CpuStorage[T]) UpsampleNearest2d(layout *candy.Layout, targetH, targetW int) (candy.BackendStorage[T], error)
- func (s *CpuStorage[T]) WhereCond(condLayout *candy.Layout, t candy.BackendStorage[T], tLayout *candy.Layout, ...) (candy.BackendStorage[T], error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCpuDevice ¶
func NewCpuDevice[T kernels.D]() candy.BackendDevice[T]
NewCpuDevice creates a new CPU device.
Types ¶
type CpuDevice ¶
CpuDevice is a CPU-based implementation of the BackendDevice interface.
func (*CpuDevice[T]) Alloc ¶
func (c *CpuDevice[T]) Alloc(shape *candy.Shape, dtype candy.DType) (candy.BackendStorage[T], error)
Alloc allocates a zero-initialized storage for the given shape.
func (*CpuDevice[T]) Full ¶
func (c *CpuDevice[T]) Full(shape *candy.Shape, dtype candy.DType, value float64) (candy.BackendStorage[T], error)
Full creates a storage filled with a specific value.
func (*CpuDevice[T]) IsSame ¶
func (c *CpuDevice[T]) IsSame(other candy.BackendDevice[T]) bool
IsSame checks if another device is a CpuDevice.
func (*CpuDevice[T]) Location ¶
func (c *CpuDevice[T]) Location() candy.DeviceLocation
Location returns the CPU device location.
func (*CpuDevice[T]) RandNormal ¶
func (c *CpuDevice[T]) RandNormal(shape *candy.Shape, dtype candy.DType, mean, std float64) (candy.BackendStorage[T], error)
RandNormal generates a storage with normally distributed random values.
func (*CpuDevice[T]) RandUniform ¶
func (c *CpuDevice[T]) RandUniform(shape *candy.Shape, dtype candy.DType, min, max float64) (candy.BackendStorage[T], error)
RandUniform generates a storage with uniformly distributed random values.
func (*CpuDevice[T]) StorageFromCpuStorage ¶
func (c *CpuDevice[T]) StorageFromCpuStorage(s *CpuStorage[T]) (candy.BackendStorage[T], error)
StorageFromCpuStorage creates a copy of the given CpuStorage.
func (*CpuDevice[T]) StorageFromSlice ¶
func (c *CpuDevice[T]) StorageFromSlice(data []T) (candy.BackendStorage[T], error)
StorageFromSlice creates a CpuStorage from a slice of data.
func (*CpuDevice[T]) Synchronize ¶
Synchronize is a no-op for CPU operations.
type CpuStorage ¶
func New ¶
func New[T kernels.D](data []T) *CpuStorage[T]
func (*CpuStorage[T]) Abs ¶
func (s *CpuStorage[T]) Abs(layout *candy.Layout) (candy.BackendStorage[T], error)
Abs performs element-wise absolute value operation
func (*CpuStorage[T]) Add ¶
func (s *CpuStorage[T]) Add(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[T], error)
Add performs element-wise addition of two tensors.
func (*CpuStorage[T]) Affine ¶
func (s *CpuStorage[T]) Affine(layout *candy.Layout, scale, bias T) (candy.BackendStorage[T], error)
Affine performs an affine transformation on the storage.
func (*CpuStorage[T]) Argmax ¶
func (s *CpuStorage[T]) Argmax(layout *candy.Layout, dim int) (candy.BackendStorage[uint32], error)
Argmax computes the index of maximum over the specified dimension
func (*CpuStorage[T]) Argmin ¶
func (s *CpuStorage[T]) Argmin(layout *candy.Layout, dim int) (candy.BackendStorage[uint32], error)
Argmin computes the index of minimum over the specified dimension
func (*CpuStorage[T]) AvgPool2d ¶
func (s *CpuStorage[T]) AvgPool2d(layout *candy.Layout, kH, kW, sH, sW int) (candy.BackendStorage[T], error)
AvgPool2d performs 2D average pooling for supported types.
func (*CpuStorage[T]) CastFromF32 ¶
func (*CpuStorage[T]) CastFromF64 ¶
func (*CpuStorage[T]) CastFromI64 ¶
func (*CpuStorage[T]) CastFromU8 ¶
func (*CpuStorage[T]) CastFromU32 ¶
func (*CpuStorage[T]) Ceil ¶
func (s *CpuStorage[T]) Ceil(layout *candy.Layout) (candy.BackendStorage[T], error)
Ceil performs element-wise ceiling operation
func (*CpuStorage[T]) Clone ¶
func (s *CpuStorage[T]) Clone() (candy.BackendStorage[T], error)
func (*CpuStorage[T]) ConstSet ¶
func (s *CpuStorage[T]) ConstSet(layout *candy.Layout, val T) error
ConstSet sets all elements to a constant value for supported types.
func (*CpuStorage[T]) Conv1d ¶
func (s *CpuStorage[T]) Conv1d(layout *candy.Layout, kernel candy.BackendStorage[T], kernelLayout *candy.Layout, params *candy.Conv1DParams) (candy.BackendStorage[T], error)
Conv1d performs 1D convolution using im2col + BLAS for supported types.
func (*CpuStorage[T]) Conv2d ¶
func (s *CpuStorage[T]) Conv2d(layout *candy.Layout, kernel candy.BackendStorage[T], kernelLayout *candy.Layout, params *candy.Conv2DParams) (candy.BackendStorage[T], error)
Conv2d performs 2D convolution using im2col + BLAS for supported types.
func (*CpuStorage[T]) ConvTranspose1d ¶
func (s *CpuStorage[T]) ConvTranspose1d(layout *candy.Layout, kernel candy.BackendStorage[T], kernelLayout *candy.Layout, params *candy.ConvT1DParams) (candy.BackendStorage[T], error)
ConvTranspose1d performs 1D transposed convolution (deconvolution) for supported types.
func (*CpuStorage[T]) ConvTranspose2d ¶
func (s *CpuStorage[T]) ConvTranspose2d(layout *candy.Layout, kernel candy.BackendStorage[T], kernelLayout *candy.Layout, params *candy.ConvT2DParams) (candy.BackendStorage[T], error)
ConvTranspose2d performs 2D transposed convolution (deconvolution) for supported types.
func (*CpuStorage[T]) Copy ¶
func (s *CpuStorage[T]) Copy(layout *candy.Layout, src candy.BackendStorage[T]) (candy.BackendStorage[T], error)
Copy performs element-wise copy operation
func (*CpuStorage[T]) Copy2d ¶
func (s *CpuStorage[T]) Copy2d(dst candy.BackendStorage[T], d1, d2 int, srcStride1, dstStride1, srcOffset, dstOffset int) error
Copy2d copies a 2D region from source to destination for supported types.
func (*CpuStorage[T]) Cos ¶
func (s *CpuStorage[T]) Cos(layout *candy.Layout) (candy.BackendStorage[T], error)
Cos performs element-wise cosine operation
func (*CpuStorage[T]) DType ¶
func (s *CpuStorage[T]) DType() candy.DType
func (*CpuStorage[T]) Data ¶
func (s *CpuStorage[T]) Data() []T
func (*CpuStorage[T]) Device ¶
func (s *CpuStorage[T]) Device() candy.BackendDevice[T]
func (*CpuStorage[T]) Div ¶
func (s *CpuStorage[T]) Div(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[T], error)
Div performs element-wise division of two tensors.
func (*CpuStorage[T]) Elu ¶
func (s *CpuStorage[T]) Elu(layout *candy.Layout, alpha T) (candy.BackendStorage[T], error)
Elu performs element-wise ELU activation operation with parameter alpha
func (*CpuStorage[T]) Eq ¶
func (s *CpuStorage[T]) Eq(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[T], error)
Eq performs element-wise equality comparison of two tensors.
func (*CpuStorage[T]) EqU8 ¶
func (s *CpuStorage[T]) EqU8(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[uint8], error)
EqU8 performs element-wise equality comparison of two tensors.
func (*CpuStorage[T]) Erf ¶
func (s *CpuStorage[T]) Erf(layout *candy.Layout) (candy.BackendStorage[T], error)
Erf performs element-wise error function operation
func (*CpuStorage[T]) Exp ¶
func (s *CpuStorage[T]) Exp(layout *candy.Layout) (candy.BackendStorage[T], error)
Exp performs element-wise exponential operation
func (*CpuStorage[T]) FastArgmax ¶
func (s *CpuStorage[T]) FastArgmax(layout *candy.Layout) (candy.BackendStorage[uint32], error)
FastArgmax computes the indices of maximum values over the last dimension
func (*CpuStorage[T]) FastArgmin ¶
func (s *CpuStorage[T]) FastArgmin(layout *candy.Layout) (candy.BackendStorage[uint32], error)
FastArgmin computes the indices of minimum values over the last dimension
func (*CpuStorage[T]) FastLayerNorm ¶
func (s *CpuStorage[T]) FastLayerNorm(layout *candy.Layout, alpha candy.BackendStorage[T], alphaLayout *candy.Layout, beta candy.BackendStorage[T], betaLayout *candy.Layout, eps T) (candy.BackendStorage[T], error)
FastLayerNorm performs Layer normalization along the last dimension
func (*CpuStorage[T]) FastMax ¶
func (s *CpuStorage[T]) FastMax(layout *candy.Layout) (candy.BackendStorage[T], error)
FastMax computes the maximum over the last dimension
func (*CpuStorage[T]) FastMin ¶
func (s *CpuStorage[T]) FastMin(layout *candy.Layout) (candy.BackendStorage[T], error)
FastMin computes the minimum over the last dimension
func (*CpuStorage[T]) FastRmsNorm ¶
func (s *CpuStorage[T]) FastRmsNorm(layout *candy.Layout, alpha candy.BackendStorage[T], alphaLayout *candy.Layout, eps T) (candy.BackendStorage[T], error)
FastRmsNorm performs RMS normalization along the last dimension
func (*CpuStorage[T]) FastSoftmax ¶
func (s *CpuStorage[T]) FastSoftmax(layout *candy.Layout) (candy.BackendStorage[T], error)
FastSoftmax performs softmax along the last dimension
func (*CpuStorage[T]) FastSum ¶
func (s *CpuStorage[T]) FastSum(layout *candy.Layout) (candy.BackendStorage[T], error)
FastSum computes the sum over the last dimension
func (*CpuStorage[T]) Floor ¶
func (s *CpuStorage[T]) Floor(layout *candy.Layout) (candy.BackendStorage[T], error)
Floor performs element-wise floor operation
func (*CpuStorage[T]) Gather ¶
func (s *CpuStorage[T]) Gather(layout *candy.Layout, ids candy.BackendStorage[T], idsLayout *candy.Layout, dim int) (candy.BackendStorage[T], error)
Gather performs gather operation along a specified dimension with same-type indices
func (*CpuStorage[T]) Ge ¶
func (s *CpuStorage[T]) Ge(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[T], error)
Ge performs element-wise greater-than-or-equal comparison of two tensors.
func (*CpuStorage[T]) GeU8 ¶
func (s *CpuStorage[T]) GeU8(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[uint8], error)
GeU8 performs element-wise greater-than-or-equal comparison of two tensors.
func (*CpuStorage[T]) Gelu ¶
func (s *CpuStorage[T]) Gelu(layout *candy.Layout) (candy.BackendStorage[T], error)
Gelu performs element-wise GELU activation operation
func (*CpuStorage[T]) GeluErf ¶
func (s *CpuStorage[T]) GeluErf(layout *candy.Layout) (candy.BackendStorage[T], error)
GeluErf performs element-wise GELU (ERF-based) activation operation
func (*CpuStorage[T]) Gt ¶
func (s *CpuStorage[T]) Gt(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[T], error)
Gt performs element-wise greater-than comparison of two tensors.
func (*CpuStorage[T]) GtU8 ¶
func (s *CpuStorage[T]) GtU8(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[uint8], error)
GtU8 performs element-wise greater-than comparison of two tensors.
func (*CpuStorage[T]) Le ¶
func (s *CpuStorage[T]) Le(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[T], error)
Le performs element-wise less-than-or-equal comparison of two tensors.
func (*CpuStorage[T]) LeU8 ¶
func (s *CpuStorage[T]) LeU8(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[uint8], error)
LeU8 performs element-wise less-than-or-equal comparison of two tensors.
func (*CpuStorage[T]) Log ¶
func (s *CpuStorage[T]) Log(layout *candy.Layout) (candy.BackendStorage[T], error)
Log performs element-wise logarithm operation
func (*CpuStorage[T]) Lt ¶
func (s *CpuStorage[T]) Lt(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[T], error)
Lt performs element-wise less-than comparison of two tensors.
func (*CpuStorage[T]) LtU8 ¶
func (s *CpuStorage[T]) LtU8(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[uint8], error)
LtU8 performs element-wise less-than comparison of two tensors.
func (*CpuStorage[T]) MatMul ¶
func (s *CpuStorage[T]) MatMul(lhsLayout *candy.Layout, rhs candy.BackendStorage[T], rhsLayout *candy.Layout, b, m, n, k int) (candy.BackendStorage[T], error)
MatMul performs matrix multiplication: C = A * B
func (*CpuStorage[T]) Max ¶
func (s *CpuStorage[T]) Max(layout *candy.Layout, dim int) (candy.BackendStorage[T], error)
Max computes the maximum over the specified dimension
func (*CpuStorage[T]) MaxPool2d ¶
func (s *CpuStorage[T]) MaxPool2d(layout *candy.Layout, kH, kW, sH, sW int) (candy.BackendStorage[T], error)
MaxPool2d performs 2D max pooling for supported types.
func (*CpuStorage[T]) Maximum ¶
func (s *CpuStorage[T]) Maximum(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[T], error)
Max performs element-wise maximum of two tensors.
func (*CpuStorage[T]) Min ¶
func (s *CpuStorage[T]) Min(layout *candy.Layout, dim int) (candy.BackendStorage[T], error)
Min computes the minimum over the specified dimension
func (*CpuStorage[T]) Minimum ¶
func (s *CpuStorage[T]) Minimum(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[T], error)
Min performs element-wise minimum of two tensors.
func (*CpuStorage[T]) Mul ¶
func (s *CpuStorage[T]) Mul(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[T], error)
Mul performs element-wise multiplication of two tensors.
func (*CpuStorage[T]) Ne ¶
func (s *CpuStorage[T]) Ne(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[T], error)
Ne performs element-wise not-equal comparison of two tensors.
func (*CpuStorage[T]) NeU8 ¶
func (s *CpuStorage[T]) NeU8(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[uint8], error)
NeU8 performs element-wise not-equal comparison of two tensors.
func (*CpuStorage[T]) Neg ¶
func (s *CpuStorage[T]) Neg(layout *candy.Layout) (candy.BackendStorage[T], error)
Neg performs element-wise negation operation
func (*CpuStorage[T]) Normcdf ¶
func (s *CpuStorage[T]) Normcdf(layout *candy.Layout) (candy.BackendStorage[T], error)
Normcdf performs element-wise normal CDF operation
func (*CpuStorage[T]) Powf ¶
func (s *CpuStorage[T]) Powf(layout *candy.Layout, param T) (candy.BackendStorage[T], error)
Powf performs element-wise power operation with parameter param
func (*CpuStorage[T]) Recip ¶
func (s *CpuStorage[T]) Recip(layout *candy.Layout) (candy.BackendStorage[T], error)
Recip performs element-wise reciprocal operation
func (*CpuStorage[T]) Relu ¶
func (s *CpuStorage[T]) Relu(layout *candy.Layout) (candy.BackendStorage[T], error)
Relu performs element-wise ReLU activation operation
func (*CpuStorage[T]) Rope ¶
func (s *CpuStorage[T]) Rope(layout *candy.Layout, cos candy.BackendStorage[T], cosLayout *candy.Layout, sin candy.BackendStorage[T], sinLayout *candy.Layout) (candy.BackendStorage[T], error)
Rope performs rotary position embedding (rope variant)
func (*CpuStorage[T]) RopeI ¶
func (s *CpuStorage[T]) RopeI(layout *candy.Layout, cos candy.BackendStorage[T], cosLayout *candy.Layout, sin candy.BackendStorage[T], sinLayout *candy.Layout) (candy.BackendStorage[T], error)
RopeI performs rotary position embedding (rope_i variant)
func (*CpuStorage[T]) RopeThd ¶
func (s *CpuStorage[T]) RopeThd(layout *candy.Layout, cos candy.BackendStorage[T], cosLayout *candy.Layout, sin candy.BackendStorage[T], sinLayout *candy.Layout) (candy.BackendStorage[T], error)
RopeThd performs rotary position embedding (rope_thd variant)
func (*CpuStorage[T]) Round ¶
func (s *CpuStorage[T]) Round(layout *candy.Layout) (candy.BackendStorage[T], error)
Round performs element-wise round operation
func (*CpuStorage[T]) Scatter ¶
func (s *CpuStorage[T]) Scatter(layout *candy.Layout, ids candy.BackendStorage[T], idsLayout *candy.Layout, src candy.BackendStorage[T], srcLayout *candy.Layout, dim int) (candy.BackendStorage[T], error)
Scatter performs scatter operation along a specified dimension with same-type indices
func (*CpuStorage[T]) ScatterAdd ¶
func (s *CpuStorage[T]) ScatterAdd(layout *candy.Layout, ids candy.BackendStorage[T], idsLayout *candy.Layout, src candy.BackendStorage[T], srcLayout *candy.Layout, dim int) (candy.BackendStorage[T], error)
ScatterAdd performs scatter-add operation along a specified dimension with same-type indices
func (*CpuStorage[T]) Sigmoid ¶
func (s *CpuStorage[T]) Sigmoid(layout *candy.Layout) (candy.BackendStorage[T], error)
Sigmoid performs element-wise sigmoid activation operation
func (*CpuStorage[T]) Sign ¶
func (s *CpuStorage[T]) Sign(layout *candy.Layout) (candy.BackendStorage[T], error)
Sign performs element-wise sign operation
func (*CpuStorage[T]) Silu ¶
func (s *CpuStorage[T]) Silu(layout *candy.Layout) (candy.BackendStorage[T], error)
Silu performs element-wise SiLU (Swish) activation operation
func (*CpuStorage[T]) Sin ¶
func (s *CpuStorage[T]) Sin(layout *candy.Layout) (candy.BackendStorage[T], error)
Sin performs element-wise sine operation
func (*CpuStorage[T]) Sqr ¶
func (s *CpuStorage[T]) Sqr(layout *candy.Layout) (candy.BackendStorage[T], error)
Sqr performs element-wise square operation
func (*CpuStorage[T]) Sqrt ¶
func (s *CpuStorage[T]) Sqrt(layout *candy.Layout) (candy.BackendStorage[T], error)
Sqrt performs element-wise square root operation
func (*CpuStorage[T]) Sub ¶
func (s *CpuStorage[T]) Sub(rhs candy.BackendStorage[T], lhsLayout *candy.Layout, rhsLayout *candy.Layout, resLayout *candy.Layout) (candy.BackendStorage[T], error)
Sub performs element-wise subtraction of two tensors.
func (*CpuStorage[T]) Sum ¶
func (s *CpuStorage[T]) Sum(layout *candy.Layout, dims []int) (candy.BackendStorage[T], error)
func (*CpuStorage[T]) Tanh ¶
func (s *CpuStorage[T]) Tanh(layout *candy.Layout) (candy.BackendStorage[T], error)
Tanh performs element-wise hyperbolic tangent operation
func (*CpuStorage[T]) UpsampleNearest2d ¶
func (s *CpuStorage[T]) UpsampleNearest2d(layout *candy.Layout, targetH, targetW int) (candy.BackendStorage[T], error)
UpsampleNearest2d performs 2D nearest neighbor upsampling for supported types.
func (*CpuStorage[T]) WhereCond ¶
func (s *CpuStorage[T]) WhereCond(condLayout *candy.Layout, t candy.BackendStorage[T], tLayout *candy.Layout, f candy.BackendStorage[T], fLayout *candy.Layout) (candy.BackendStorage[T], error)
WhereCond performs element-wise selection based on condition. If s[i] != 0, result[i] = t[i], otherwise result[i] = f[i]. Note: s can be uint8, uint32, or int64 type (condition mask).