public abstract class Tensor extends Object implements Comparable<Tensor>, Iterable<Tensor>
equals() method, and
in order to compare tensors one should use TensorUtils.equals(Tensor, Tensor).Indices,
TensorUtils.equals(Tensor, Tensor)| Constructor and Description |
|---|
Tensor() |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Tensor t)
Compares tensors by their hash codes.
|
abstract Tensor |
get(int i)
Returns element at i-th position.
|
abstract TensorBuilder |
getBuilder()
Creates a builder for this tensor.
|
abstract TensorFactory |
getFactory()
Returns a factory for this tensor.
|
abstract Indices |
getIndices()
Returns indices of this tensor.
|
Tensor[] |
getRange(int from,
int to)
Retrieves several sub-tensors from current tensor.
|
protected abstract int |
hash()
Hash code of this tensor.
|
int |
hashCode() |
Iterator<Tensor> |
iterator()
Return read-only iterator over tensor elements.
|
Tensor |
set(int i,
Tensor tensor)
Returns new tensor instance with i-th sub-tensor replaced by provided
tensor.
|
abstract int |
size()
Returns the number of elements in this tensor.
|
Tensor[] |
toArray() |
String |
toString()
Returns a string representation of a tensor according to the default
OutputFormat defined in
CC.getDefaultOutputFormat(). |
abstract String |
toString(OutputFormat outputFormat)
Returns a string representation of a tensor according to the specified
OutputFormat. |
protected String |
toString(OutputFormat mode,
Class<? extends Tensor> clazz)
For internal use.
|
protected abstract int hash()
public abstract Indices getIndices()
public abstract Tensor get(int i)
i - positionIndexOutOfBoundsException - if i < 0 or i >= size()public abstract int size()
public Tensor set(int i, Tensor tensor)
i - index of sub-tensor to be replacedtensor - tensor to replace i-th sub-tensorpublic Tensor[] getRange(int from, int to)
get(int) method.from - index of first sub-tensor to be retrieved (inclusive)to - next index after last sub-tensor to be retrieved (exclusive)public Tensor[] toArray()
public abstract String toString(OutputFormat outputFormat)
OutputFormat.outputFormat - output formatpublic final String toString()
OutputFormat defined in
CC.getDefaultOutputFormat().protected String toString(OutputFormat mode, Class<? extends Tensor> clazz)
public final int compareTo(Tensor t)
compareTo in interface Comparable<Tensor>t - tensorpublic abstract TensorBuilder getBuilder()
TensorBuilder for more
information.public abstract TensorFactory getFactory()
TensorFactory for more
information.Copyright © 2014. All Rights Reserved.