public abstract class JVMTensor<T,TENSOR extends Tensor<T,TENSOR>,B extends JVMBuffer.PrimitiveArrayWrapper<T,B>> extends java.lang.Object implements Tensor<T,TENSOR>
Tensor.FlattenedView<N>| Modifier and Type | Field and Description |
|---|---|
protected B |
buffer |
protected long[] |
shape |
protected long[] |
stride |
ONE_BY_ONE_SHAPE, SCALAR_SHAPE, SCALAR_STRIDE| Modifier | Constructor and Description |
|---|---|
protected |
JVMTensor(B buffer,
long[] shape,
long[] stride) |
| Modifier and Type | Method and Description |
|---|---|
static <T,B extends JVMBuffer.PrimitiveArrayWrapper<T,B>> |
argCompare(B buffer,
java.util.function.BiFunction<T,T,java.lang.Boolean> compareOp) |
int |
argCompare(java.util.function.BiFunction<T,T,java.lang.Boolean> compareOp) |
IntegerTensor |
argCompare(java.util.function.BiFunction<T,T,java.lang.Boolean> compareOp,
int axis) |
static <T,B extends JVMBuffer.PrimitiveArrayWrapper<T,B>> |
argCompare(JVMBuffer.ArrayWrapperFactory<T,B> factory,
B buffer,
java.util.function.BiFunction<T,T,java.lang.Boolean> compareOp,
long[] shape,
long[] stride,
int axis) |
TENSOR |
broadcast(long... toShape) |
protected TENSOR |
broadcastableBinaryOpWithAutoBroadcast(java.util.function.BiFunction<T,T,T> op,
JVMTensor<T,TENSOR,B> right) |
static <T,B extends JVMBuffer.PrimitiveArrayWrapper<T,B>> |
concat(JVMBuffer.ArrayWrapperFactory<T,B> factory,
Tensor[] tensors,
int dimension,
java.util.List<B> toConcat) |
static <T,B extends JVMBuffer.PrimitiveArrayWrapper<T,B>> |
concatOnDimensionZero(JVMBuffer.ArrayWrapperFactory<T,B> factory,
long[] concatShape,
java.util.List<B> toConcat) |
protected abstract TENSOR |
create(B buffer,
long[] shape,
long[] stride) |
TENSOR |
diag() |
static <T,B extends JVMBuffer.PrimitiveArrayWrapper<T,B>> |
diag(int rank,
long[] shape,
B buffer,
JVMBuffer.ArrayWrapperFactory<T,B> factory) |
boolean |
equals(java.lang.Object o) |
TENSOR |
get(BooleanTensor booleanIndex) |
protected abstract JVMBuffer.ArrayWrapperFactory<T,B> |
getFactory() |
long |
getLength() |
int |
getRank() |
long[] |
getShape() |
long[] |
getStride()
Returns the stride for each dimension of the tensor (based on C ordering).
|
int |
hashCode() |
BooleanTensor |
isApply(java.util.function.Function<T,java.lang.Boolean> op) |
TENSOR |
permute(int... rearrange) |
static <T,B extends JVMBuffer.PrimitiveArrayWrapper<T,B>> |
permute(JVMBuffer.ArrayWrapperFactory<T,B> factory,
B buffer,
long[] shape,
long[] stride,
int... rearrange) |
TENSOR |
reshape(long... newShape) |
protected abstract TENSOR |
set(B buffer,
long[] shape,
long[] stride) |
TENSOR |
slice(int dimension,
long index) |
static <T,B extends JVMBuffer.PrimitiveArrayWrapper<T,B>> |
slice(JVMBuffer.ArrayWrapperFactory<T,B> factory,
B buffer,
IndexMapper indexMapper) |
TENSOR |
slice(Slicer slicer) |
java.util.List<TENSOR> |
split(int dimension,
long... splitAtIndices) |
static <T,B extends JVMBuffer.PrimitiveArrayWrapper<T,B>> |
split(JVMBuffer.ArrayWrapperFactory<T,B> factory,
B fromBuffer,
long[] shape,
long[] stride,
int dimension,
long... splitAtIndices) |
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitasFlatArray, asFlatList, create, createFilled, duplicate, elementwiseEquals, elementwiseEquals, elementwiseEquals, expandDims, getFlattenedView, getValue, hasSameShapeAs, hasSameShapeAs, isLengthOne, isMatrix, isScalar, isVector, moveAxis, scalar, scalar, setValue, slice, sliceAlongDimension, squeeze, swapAxis, take, transposeprotected B extends JVMBuffer.PrimitiveArrayWrapper<T,B> buffer
protected long[] shape
protected long[] stride
protected JVMTensor(B buffer, long[] shape, long[] stride)
public int getRank()
public long[] getShape()
public long[] getStride()
TensorThe stride is the distance you'd move in a flat representation of the tensor for each index within that dimension EG) For a 2x2 Tensor the Tensor would be laid out (in C order): [{0, 0}, {0, 1}, {1, 0}, {1, 1}] Thus the stride array would be provided as: [2, 1]
public long getLength()
public TENSOR get(BooleanTensor booleanIndex)
public static <T,B extends JVMBuffer.PrimitiveArrayWrapper<T,B>> ResultWrapper<T,B> diag(int rank, long[] shape, B buffer, JVMBuffer.ArrayWrapperFactory<T,B> factory)
public TENSOR permute(int... rearrange)
public static <T,B extends JVMBuffer.PrimitiveArrayWrapper<T,B>> ResultWrapper<T,B> permute(JVMBuffer.ArrayWrapperFactory<T,B> factory, B buffer, long[] shape, long[] stride, int... rearrange)
public java.util.List<TENSOR> split(int dimension, long... splitAtIndices)
split in interface Tensor<T,TENSOR extends Tensor<T,TENSOR>>dimension - the dimension to split onsplitAtIndices - the indices that the dimension to split on should be split one.g A = [ 1, 2, 3, 4, 5, 6 7, 8, 9, 1, 2, 3 ]
A.split(0, [1]) gives List([1, 2, 3, 4, 5, 6]) A.split(0, [1, 2]) gives List([1, 2, 3, 4, 5, 6], [7, 8, 9, 1, 2, 3]
A.split(1, [1, 3, 6]) gives List( [1, [2, 3 , [4, 5, 6, 7] 8, 9] 1, 2, 3] )
public static <T,B extends JVMBuffer.PrimitiveArrayWrapper<T,B>> java.util.List<ResultWrapper<T,B>> split(JVMBuffer.ArrayWrapperFactory<T,B> factory, B fromBuffer, long[] shape, long[] stride, int dimension, long... splitAtIndices)
public TENSOR slice(int dimension, long index)
public static <T,B extends JVMBuffer.PrimitiveArrayWrapper<T,B>> ResultWrapper<T,B> slice(JVMBuffer.ArrayWrapperFactory<T,B> factory, B buffer, IndexMapper indexMapper)
public static <T,B extends JVMBuffer.PrimitiveArrayWrapper<T,B>> ResultWrapper<T,B> concat(JVMBuffer.ArrayWrapperFactory<T,B> factory, Tensor[] tensors, int dimension, java.util.List<B> toConcat)
public static <T,B extends JVMBuffer.PrimitiveArrayWrapper<T,B>> B concatOnDimensionZero(JVMBuffer.ArrayWrapperFactory<T,B> factory, long[] concatShape, java.util.List<B> toConcat)
protected TENSOR broadcastableBinaryOpWithAutoBroadcast(java.util.function.BiFunction<T,T,T> op, JVMTensor<T,TENSOR,B> right)
public TENSOR reshape(long... newShape)
public TENSOR broadcast(long... toShape)
public IntegerTensor argCompare(java.util.function.BiFunction<T,T,java.lang.Boolean> compareOp, int axis)
public static <T,B extends JVMBuffer.PrimitiveArrayWrapper<T,B>> IntegerTensor argCompare(JVMBuffer.ArrayWrapperFactory<T,B> factory, B buffer, java.util.function.BiFunction<T,T,java.lang.Boolean> compareOp, long[] shape, long[] stride, int axis)
public static <T,B extends JVMBuffer.PrimitiveArrayWrapper<T,B>> int argCompare(B buffer, java.util.function.BiFunction<T,T,java.lang.Boolean> compareOp)
public BooleanTensor isApply(java.util.function.Function<T,java.lang.Boolean> op)
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectprotected abstract JVMBuffer.ArrayWrapperFactory<T,B> getFactory()