Sparse, FFT & Advanced Ops
CSRMatrix
Compressed Sparse Row (CSR) matrix representation.
Column to Image operation (col2im).
Image to Column operation (im2col).
Einstein summation convention.
Ensure the input is at least 1-D.
Ensure the input is at least 2-D.
bartlettWindow is exported by deepbox/ndarray.
Count number of occurrences of each value in a non-negative integer tensor.
blackmanWindow is exported by deepbox/ndarray.
Select elements from a tensor using a boolean mask.
Broadcast a tensor to a target shape.
Create a deep copy of a tensor with its own data buffer.
Return a contiguous tensor.
convolve is exported by deepbox/ndarray.
Create an explicit deep copy of a tensor (alias for clone).
correlate is exported by deepbox/ndarray.
Compute the cross product of two 3-element vectors.
Create a copy of a tensor detached from any computation graph.
Extract a diagonal or construct a diagonal matrix.
Extract the k-th diagonal from a 2-D tensor.
Create an uninitialized tensor with the same shape and dtype as the input tensor.
Select elements from a tensor using integer index arrays.
Compute the one-dimensional discrete Fourier Transform.
Compute the 2-dimensional discrete Fourier Transform.
Compute the n-dimensional discrete Fourier Transform.
Reverse the order of elements along the given axes.
Flip a 2-D tensor left-right (reverse columns).
Flip a 2-D tensor up-down (reverse rows).
Create a tensor filled with a specified value, matching the shape and dtype of the input.
hammingWindow is exported by deepbox/ndarray.
hannWindow is exported by deepbox/ndarray.
Compute the histogram of a 1-D tensor.
Compute the one-dimensional inverse discrete Fourier Transform.
Compute the 2-dimensional inverse discrete Fourier Transform.
Compute the n-dimensional inverse discrete Fourier Transform.
Select elements along a dimension using an index tensor.
Compute the inverse FFT for rfft output (Hermitian-symmetric).
Test whether each element of `a` is in `values`.
kaiserWindow is exported by deepbox/ndarray.
Return coordinate matrices from coordinate vectors.
Move axes of a tensor to new positions.
Maximum of elements, ignoring NaN values.
Mean of elements, ignoring NaN values.
Minimum of elements, ignoring NaN values.
Standard deviation of elements, ignoring NaN values.
Sum of elements, ignoring NaN values.
Create a tensor of ones with the same shape and dtype as the input tensor.
Pad a tensor with values.
Compute the one-dimensional FFT for real input.
Roll tensor elements along the given axis.
Rotate a 2-D tensor by 90 degrees counter-clockwise.
Scatter values into a tensor at specified indices along an axis.
Find indices where elements should be inserted to maintain order.
Swap two axes of a tensor.
Return the lower triangular part of a 2-D tensor, with elements above the k-th diagonal zeroed.
Return the upper triangular part of a 2-D tensor, with elements below the k-th diagonal zeroed.
Return the unique elements of a tensor, sorted in ascending order.
Conditional element selection: returns elements from `x` where `condition` is true, and from `y` where `condition` is false.
Create a tensor of zeros with the same shape and dtype as the input tensor.
Generate a tensor of Bernoulli samples scaled by a constant.
import { CSRMatrix, dropoutMask, einsum, fft, ifft, rfft, tensor } from "deepbox/ndarray";const dense = tensor([ [1, 0, 0], [0, 2, 3],]);const sparse = CSRMatrix.fromCOO({ rows: 2, cols: 3, rowIndices: new Int32Array([0, 1, 1]), colIndices: new Int32Array([0, 1, 2]), values: new Float64Array([1, 2, 3]),});const signal = tensor([1, 2, 3, 4]);const spectrum = fft(signal);console.log(dense.toString());console.log(sparse.toDense().toString());console.log(einsum("ij,jk->ik", dense, tensor([[1], [2], [3]])).toString());console.log(spectrum.real.toString());console.log(rfft(signal).real.toString());console.log(ifft(spectrum.real, spectrum.imag).real.toString());console.log(dropoutMask(signal.shape, 0.25, 1 / (1 - 0.25), "float32", "cpu").toString());