Package com.yahoo.tensor
Class MappedTensor
- java.lang.Object
-
- com.yahoo.tensor.MappedTensor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MappedTensor.Builder
-
Nested classes/interfaces inherited from interface com.yahoo.tensor.Tensor
Tensor.Cell
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Iterator<Tensor.Cell>
cellIterator()
Returns the cell of this in some undefined order.java.util.Map<TensorAddress,java.lang.Double>
cells()
Returns an immutable map of the cells of this in no particular order.boolean
equals(java.lang.Object other)
Returns whether this tensor and the given tensor is mathematically equal: That they have the same dimension *names* and the same content.double
get(TensorAddress address)
Returns the value of a cell, or NaN if this cell does not exist/have no valueint
hashCode()
Tensor
remove(java.util.Set<TensorAddress> addresses)
Returns a new tensor where existing cells in this tensor have been removed according to the given set of addresses.long
size()
Returns the number of cells in thisjava.lang.String
toString()
Returns this tensor on the tensor literal form with type included.TensorType
type()
java.util.Iterator<java.lang.Double>
valueIterator()
Returns the values of this in some undefined orderTensor
withType(TensorType other)
Returns this tensor with the given type if types are compatible-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.yahoo.tensor.Tensor
add, approxEqual, argmax, argmin, asDouble, atan2, avg, avg, avg, concat, concat, count, count, count, divide, equal, fmod, isEmpty, join, l1Normalize, l2Normalize, larger, largerOrEqual, largest, ldexp, map, matmul, max, max, max, max, median, median, median, merge, min, min, min, min, modify, multiply, notEqual, pow, prod, prod, prod, reduce, reduce, rename, rename, smaller, smallerOrEqual, smallest, softmax, subtract, sum, sum, sum, xwPlusB
-
-
-
-
Method Detail
-
type
public TensorType type()
-
size
public long size()
Description copied from interface:Tensor
Returns the number of cells in this
-
get
public double get(TensorAddress address)
Description copied from interface:Tensor
Returns the value of a cell, or NaN if this cell does not exist/have no value
-
cellIterator
public java.util.Iterator<Tensor.Cell> cellIterator()
Description copied from interface:Tensor
Returns the cell of this in some undefined order. A cell instances is only valid until next() is called. Call detach() on the cell to obtain a long-lived instance.- Specified by:
cellIterator
in interfaceTensor
-
valueIterator
public java.util.Iterator<java.lang.Double> valueIterator()
Description copied from interface:Tensor
Returns the values of this in some undefined order- Specified by:
valueIterator
in interfaceTensor
-
cells
public java.util.Map<TensorAddress,java.lang.Double> cells()
Description copied from interface:Tensor
Returns an immutable map of the cells of this in no particular order. This may be expensive for some implementations - avoid when possible
-
withType
public Tensor withType(TensorType other)
Description copied from interface:Tensor
Returns this tensor with the given type if types are compatible
-
remove
public Tensor remove(java.util.Set<TensorAddress> addresses)
Description copied from interface:Tensor
Returns a new tensor where existing cells in this tensor have been removed according to the given set of addresses. Only valid for sparse or mixed tensors. For mixed tensors, addresses are assumed to only contain the sparse dimensions, as the entire dense subspace is removed.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
Description copied from interface:Tensor
Returns this tensor on the tensor literal form with type included.
-
equals
public boolean equals(java.lang.Object other)
Description copied from interface:Tensor
Returns whether this tensor and the given tensor is mathematically equal: That they have the same dimension *names* and the same content.
-
-