V
- the type of the values of the tensorspublic final class TensorPair<V> extends AbstractPair<Tensor<V>>
Modifier and Type | Method and Description |
---|---|
static <V> TensorPair<V> |
fromLeftRight(Tensor<V> leftTensor,
Tensor<V> rightTensor) |
ValuePair<V> |
get(PositionPair positionPair)
Retrieves a pair of values from the two tensors.
|
java.util.List<ValuePair<V>> |
getAll(java.lang.Iterable<PositionPair> positionPairs)
Extracts all the value pairs of the tensor pair, according to the given iterable of position pairs.
|
<K> com.google.common.collect.ListMultimap<K,ValuePair<V>> |
mapValues(com.google.common.collect.Multimap<K,PositionPair> positionPairs)
Extracts pairs of values, according to the given multimap of position pairs and returns them again as a multimap.
|
equals, hashCode, left, right
public static <V> TensorPair<V> fromLeftRight(Tensor<V> leftTensor, Tensor<V> rightTensor)
public ValuePair<V> get(PositionPair positionPair)
positionPair
- the pair of positions for which the values have to be retrievedjava.lang.NullPointerException
- if the given position pair is null or one of the values, retrieved from the tensors
is null
public java.util.List<ValuePair<V>> getAll(java.lang.Iterable<PositionPair> positionPairs)
positionPairs
- the position pairs for which the value pairs have to be extractejava.lang.NullPointerException
- if the given positionPairs are null
, or no values are contained for at least
one of the positions.public <K> com.google.common.collect.ListMultimap<K,ValuePair<V>> mapValues(com.google.common.collect.Multimap<K,PositionPair> positionPairs)
ListMultimap
, because it
is easily possible that the returned value pairs are the same for different keys.positionPairs
- a multimap K: pairs of positions for which to retrieve the values