Package com.yahoo.tensor.functions
Class Rename
- java.lang.Object
-
- com.yahoo.tensor.functions.TensorFunction
-
- com.yahoo.tensor.functions.PrimitiveTensorFunction
-
- com.yahoo.tensor.functions.Rename
-
public class Rename extends PrimitiveTensorFunction
The rename tensor function returns a tensor where some dimensions are assigned new names.- Author:
- bratseth
-
-
Constructor Summary
Constructors Constructor Description Rename(TensorFunction argument, java.lang.String fromDimension, java.lang.String toDimension)
Rename(TensorFunction argument, java.util.List<java.lang.String> fromDimensions, java.util.List<java.lang.String> toDimensions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<TensorFunction>
arguments()
Returns the function arguments of this node in the order they are applied<NAMETYPE extends TypeContext.Name>
Tensorevaluate(EvaluationContext<NAMETYPE> context)
Evaluates this tensor.java.util.List<java.lang.String>
fromDimensions()
java.util.List<java.lang.String>
toDimensions()
PrimitiveTensorFunction
toPrimitive()
Translate this function - and all of its arguments recursively - to a tree of primitive functions only.java.lang.String
toString(ToStringContext context)
Return a string representation of this context.<NAMETYPE extends TypeContext.Name>
TensorTypetype(TypeContext<NAMETYPE> context)
Returns the type of the tensor this produces given the input types in the contextTensorFunction
withArguments(java.util.List<TensorFunction> arguments)
Returns a copy of this tensor function with the arguments replaced by the given list of arguments.-
Methods inherited from class com.yahoo.tensor.functions.TensorFunction
evaluate, toString
-
-
-
-
Constructor Detail
-
Rename
public Rename(TensorFunction argument, java.lang.String fromDimension, java.lang.String toDimension)
-
Rename
public Rename(TensorFunction argument, java.util.List<java.lang.String> fromDimensions, java.util.List<java.lang.String> toDimensions)
-
-
Method Detail
-
fromDimensions
public java.util.List<java.lang.String> fromDimensions()
-
toDimensions
public java.util.List<java.lang.String> toDimensions()
-
arguments
public java.util.List<TensorFunction> arguments()
Description copied from class:TensorFunction
Returns the function arguments of this node in the order they are applied- Specified by:
arguments
in classTensorFunction
-
withArguments
public TensorFunction withArguments(java.util.List<TensorFunction> arguments)
Description copied from class:TensorFunction
Returns a copy of this tensor function with the arguments replaced by the given list of arguments.- Specified by:
withArguments
in classTensorFunction
-
toPrimitive
public PrimitiveTensorFunction toPrimitive()
Description copied from class:TensorFunction
Translate this function - and all of its arguments recursively - to a tree of primitive functions only.- Specified by:
toPrimitive
in classTensorFunction
- Returns:
- a tree of primitive functions implementing this
-
type
public <NAMETYPE extends TypeContext.Name> TensorType type(TypeContext<NAMETYPE> context)
Description copied from class:TensorFunction
Returns the type of the tensor this produces given the input types in the context- Specified by:
type
in classTensorFunction
- Parameters:
context
- a context which must be passed to all nexted functions when evaluating
-
evaluate
public <NAMETYPE extends TypeContext.Name> Tensor evaluate(EvaluationContext<NAMETYPE> context)
Description copied from class:TensorFunction
Evaluates this tensor.- Specified by:
evaluate
in classTensorFunction
- Parameters:
context
- a context which must be passed to all nexted functions when evaluating
-
toString
public java.lang.String toString(ToStringContext context)
Description copied from class:TensorFunction
Return a string representation of this context.- Specified by:
toString
in classTensorFunction
- Parameters:
context
- a context which must be passed to all nested functions when requesting the string value
-
-