Class Tensor
java.lang.Object
io.github.kirstenali.deepj.tensor.TensorStorageAccess
io.github.kirstenali.deepj.tensor.TensorManipulations
io.github.kirstenali.deepj.tensor.Tensor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidadamWUpdate(Tensor w, Tensor g, Tensor mt, Tensor vt, float lr, float beta1, float beta2, float eps, float weightDecay, float bc1, float bc2) addBroadcastCols(Tensor colVector) addBroadcastRows(Tensor rowVector) addInPlace(Tensor other) addRowVector(Tensor rowVector) addScalar(float s) addScalarInPlace(float scalar) static TensorBackendbackend()voidbackward()voidstatic TensorcausalMask(int size) clamp(float min, float max) copy()Bit-preserving independent storage with an identity autograd edge.floatcrossEntropyLoss(int[] targets) float[]data()Materializes and returns the backing FLOAT32 array of a full contiguous tensor.detach()Independent detached storage, preserving DeepJ's existing copy-based detach behavior.divideBroadcastCols(Tensor colVector) divideInPlace(Tensor other) divideScalar(float s) divideScalarInPlace(float scalar) exp()static Tensorfrom(float[] values) static Tensorfrom(float[] values, int... shape) static Tensorstatic Tensorstatic Tensorfrom2D(float[][] data) getRow(int row) grad()floatitem()log()voidmultiplyBroadcastCols(Tensor colVector) multiplyBroadcastRows(Tensor rowVector) multiplyInPlace(Tensor other) multiplyScalar(float s) multiplyScalarInPlace(float scalar) neg()static Tensorones(int rows, int cols) pow(float exponent) voidstatic Tensorstatic voidrequireSameShape(Tensor a, Tensor b, String op) requiresGrad(boolean required) static voidrequireTargetsMatchRows(Tensor logits, int[] targets) float[]rowData(int r) static TensorsampleRows(Tensor t, int n, Random rnd) static voidscatterAddRows(Tensor target, int[] indices, Tensor grad) static voidsetBackend(TensorBackend backend) voidstatic Tensorsqrt()subtractBroadcastCols(Tensor colVector) subtractInPlace(Tensor other) floatsum()floatsumAbs()sumRows()protected Tensortensor()voidzeroGrad()static Tensorzeros(int rows, int cols) Methods inherited from class io.github.kirstenali.deepj.tensor.TensorManipulations
contiguous, copyFrom, expand, indexAddInPlace, indexSelect, maxAxes, maximum, mean, meanAxes, ones, permute, random, requiresGrad, reshape, select, slice, slice, softmax, sum, sumAxes, to, transpose, unsqueeze, variance, variance, varianceAxes, view, zerosMethods inherited from class io.github.kirstenali.deepj.tensor.TensorStorageAccess
coversStorage, dtype, get, get, getGpuTag, gradientState, hasHostStorage, hasSameShape, hasShape, isContiguous, matrixCols, matrixRows, numel, rank, rawData, releaseDeviceBufferRetention, retainsDeviceBuffer, set, setAt, setGpuTag, shape, size, storageBytes, storageOffset, strides, toFloatArray
-
Constructor Details
-
Tensor
public Tensor(int... shape) -
Tensor
public Tensor(int rows, int cols) -
Tensor
-
Tensor
-
-
Method Details
-
tensor
- Specified by:
tensorin classTensorManipulations
-
requiresGrad
-
grad
-
zeroGrad
public void zeroGrad() -
backward
public void backward() -
backward
-
detach
Independent detached storage, preserving DeepJ's existing copy-based detach behavior. -
copy
Bit-preserving independent storage with an identity autograd edge. -
sumTensor
-
item
public float item() -
retainDeviceBuffer
-
setBackend
-
backend
-
data
public float[] data()Materializes and returns the backing FLOAT32 array of a full contiguous tensor. -
rowData
public float[] rowData(int r) -
materialize
public void materialize()- Specified by:
materializein classTensorStorageAccess
-
matmul
-
add
-
subtract
-
multiply
-
divide
-
addRowVector
-
addBroadcastCols
-
divideBroadcastCols
-
subtractBroadcastCols
-
multiplyBroadcastCols
-
addBroadcastRows
-
multiplyBroadcastRows
-
multiplyScalar
-
addScalar
-
divideScalar
-
sumRows
-
sumAlongRows
-
sumAlongCols
-
meanAlongRows
-
varianceAlongRows
-
transpose
-
sqrt
-
neg
-
exp
-
log
-
tanhActivation
-
sigmoidActivation
-
reluActivation
-
geluActivation
-
addInPlace
-
subtractInPlace
-
multiplyInPlace
-
divideInPlace
-
multiplyScalarInPlace
-
addScalarInPlace
-
divideScalarInPlace
-
sqrtInPlace
-
negInPlace
-
expInPlace
-
logInPlace
-
reluInPlace
-
geluInPlace
-
tanhInPlace
-
sigmoidInPlace
-
softmaxRows
-
adamWUpdate
-
maxAlongRows
-
clamp
-
pow
-
scatterAddRows
-
from2D
-
from
-
from
-
from
-
from
-
sum
public float sum() -
sumAbs
public float sumAbs() -
crossEntropyLoss
public float crossEntropyLoss(int[] targets) -
getRow
-
setRow
-
sliceRows
-
sampleRows
-
print
-
zeros
-
ones
-
random
-
causalMask
-
requireSameShape
-
requireTargetsMatchRows
-