public abstract class Nd4jTensor<T,TENSOR extends Tensor<T,TENSOR>> extends java.lang.Object implements Tensor<T,TENSOR>
Tensor.FlattenedView<N>| Modifier and Type | Field and Description |
|---|---|
protected org.nd4j.linalg.api.ndarray.INDArray |
tensor |
ONE_BY_ONE_SHAPE, SCALAR_SHAPE, SCALAR_STRIDE| Constructor and Description |
|---|
Nd4jTensor(org.nd4j.linalg.api.ndarray.INDArray tensor) |
| Modifier and Type | Method and Description |
|---|---|
TENSOR |
broadcast(long... toShape) |
protected abstract TENSOR |
create(org.nd4j.linalg.api.ndarray.INDArray tensor) |
TENSOR |
diag() |
TENSOR |
duplicate() |
boolean |
equals(java.lang.Object o) |
TENSOR |
get(BooleanTensor booleanIndex) |
long |
getLength() |
int |
getRank() |
long[] |
getShape() |
long[] |
getStride()
Returns the stride for each dimension of the tensor (based on C ordering).
|
org.nd4j.linalg.api.ndarray.INDArray |
getTensor() |
protected abstract org.nd4j.linalg.api.ndarray.INDArray |
getTensor(Tensor<T,?> tensor) |
protected abstract TENSOR |
getThis() |
int |
hashCode() |
TENSOR |
permute(int... rearrange) |
TENSOR |
reshape(long... newShape) |
protected abstract TENSOR |
set(org.nd4j.linalg.api.ndarray.INDArray tensor) |
TENSOR |
slice(int dimension,
long index) |
TENSOR |
slice(Slicer slicer) |
java.util.List<TENSOR> |
split(int dimension,
long... splitAtIndices) |
TENSOR |
take(long... index) |
java.lang.String |
toString() |
TENSOR |
transpose() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitasFlatArray, asFlatList, create, createFilled, elementwiseEquals, elementwiseEquals, elementwiseEquals, expandDims, getFlattenedView, getValue, hasSameShapeAs, hasSameShapeAs, isLengthOne, isMatrix, isScalar, isVector, moveAxis, scalar, scalar, setValue, slice, sliceAlongDimension, squeeze, swapAxispublic 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 TENSOR reshape(long... newShape)
public TENSOR broadcast(long... toShape)
public TENSOR permute(int... rearrange)
public TENSOR duplicate()
public TENSOR transpose()
public TENSOR slice(int dimension, long index)
public TENSOR take(long... index)
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 int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic org.nd4j.linalg.api.ndarray.INDArray getTensor()
protected abstract TENSOR create(org.nd4j.linalg.api.ndarray.INDArray tensor)
protected abstract TENSOR set(org.nd4j.linalg.api.ndarray.INDArray tensor)
protected abstract TENSOR getThis()