public class Reduce extends PrimitiveTensorFunction
Modifier and Type | Class and Description |
---|---|
static class |
Reduce.Aggregator |
private static class |
Reduce.AvgAggregator |
private static class |
Reduce.CountAggregator |
private static class |
Reduce.MaxAggregator |
private static class |
Reduce.MinAggregator |
private static class |
Reduce.ProdAggregator |
private static class |
Reduce.SumAggregator |
private static class |
Reduce.ValueAggregator |
Modifier and Type | Field and Description |
---|---|
private Reduce.Aggregator |
aggregator |
private TensorFunction |
argument |
private List<String> |
dimensions |
Constructor and Description |
---|
Reduce(TensorFunction argument,
Reduce.Aggregator aggregator)
Creates a reduce function reducing aLL dimensions
|
Reduce(TensorFunction argument,
Reduce.Aggregator aggregator,
List<String> dimensions)
Creates a reduce function.
|
Reduce(TensorFunction argument,
Reduce.Aggregator aggregator,
String dimension)
Creates a reduce function reducing a single dimension
|
Modifier and Type | Method and Description |
---|---|
TensorFunction |
argument() |
List<TensorFunction> |
arguments()
Returns the function arguments of this node in the order they are applied
|
private String |
commaSeparated(List<String> list) |
<NAMETYPE extends TypeContext.Name> |
evaluate(EvaluationContext<NAMETYPE> context)
Evaluates this tensor.
|
static TensorType |
outputType(TensorType inputType,
List<String> reduceDimensions) |
private Tensor |
reduceAllGeneral(Tensor argument) |
private TensorAddress |
reduceDimensions(TensorAddress address,
TensorType argumentType,
TensorType reducedType) |
private Tensor |
reduceIndexedVector(IndexedTensor argument) |
PrimitiveTensorFunction |
toPrimitive()
Translate this function - and all of its arguments recursively -
to a tree of primitive functions only.
|
String |
toString(ToStringContext context)
Return a string representation of this context.
|
private TensorType |
type(TensorType argumentType) |
<NAMETYPE extends TypeContext.Name> |
type(TypeContext<NAMETYPE> context)
Returns the type of the tensor this produces given the input types in the context
|
TensorFunction |
withArguments(List<TensorFunction> arguments)
Returns a copy of this tensor function with the arguments replaced by the given list of arguments.
|
evaluate, toString
private final TensorFunction argument
private final Reduce.Aggregator aggregator
public Reduce(TensorFunction argument, Reduce.Aggregator aggregator)
public Reduce(TensorFunction argument, Reduce.Aggregator aggregator, String dimension)
public Reduce(TensorFunction argument, Reduce.Aggregator aggregator, List<String> dimensions)
argument
- the tensor to reduceaggregator
- the aggregator function to usedimensions
- the list of dimensions to remove. If an empty list is given, all dimensions are reduced,
producing a dimensionless tensor (a scalar).IllegalArgumentException
- if any of the tensor dimensions are not present in the input tensorpublic static TensorType outputType(TensorType inputType, List<String> reduceDimensions)
public TensorFunction argument()
public List<TensorFunction> arguments()
TensorFunction
arguments
in class TensorFunction
public TensorFunction withArguments(List<TensorFunction> arguments)
TensorFunction
withArguments
in class TensorFunction
public PrimitiveTensorFunction toPrimitive()
TensorFunction
toPrimitive
in class TensorFunction
public String toString(ToStringContext context)
TensorFunction
toString
in class TensorFunction
context
- a context which must be passed to all nested functions when requesting the string valuepublic <NAMETYPE extends TypeContext.Name> TensorType type(TypeContext<NAMETYPE> context)
TensorFunction
type
in class TensorFunction
context
- a context which must be passed to all nexted functions when evaluatingprivate TensorType type(TensorType argumentType)
public <NAMETYPE extends TypeContext.Name> Tensor evaluate(EvaluationContext<NAMETYPE> context)
TensorFunction
evaluate
in class TensorFunction
context
- a context which must be passed to all nexted functions when evaluatingprivate TensorAddress reduceDimensions(TensorAddress address, TensorType argumentType, TensorType reducedType)
private Tensor reduceIndexedVector(IndexedTensor argument)
Copyright © 2018. All rights reserved.