Documentation
¶
Overview ¶
Package grapheval implements the evaluation of core GX functions.
Index ¶
- func FuncInputsToElements(file *ir.File, processor *processor.Processor, fType *ir.FuncType, ...) (*elements.InputElements, error)
- func GraphFromElement(name string, el ir.Element) (*ops.Subgraph, error)
- type BackendNode
- func (n *BackendNode) BinaryOp(ctx ir.Evaluator, expr *ir.BinaryExpr, x, y evaluator.NumericalElement) (evaluator.NumericalElement, error)
- func (n *BackendNode) Cast(ctx ir.Evaluator, expr ir.AssignableExpr, target ir.Type) (evaluator.NumericalElement, error)
- func (n *BackendNode) Copy() interp.Copier
- func (n *BackendNode) Materialise(materialise.Materialiser) (materialise.Node, error)
- func (n *BackendNode) OutNode() *ops.OutputNode
- func (n *BackendNode) Reshape(ctx ir.Evaluator, expr ir.AssignableExpr, ...) (evaluator.NumericalElement, error)
- func (n *BackendNode) Shape() *shape.Shape
- func (n *BackendNode) Slice(fitp *interp.FileScope, expr *ir.IndexExpr, index evaluator.NumericalElement) (ir.Element, error)
- func (n *BackendNode) SliceArray(fitp *interp.FileScope, expr ir.AssignableExpr, ...) (evaluator.NumericalElement, error)
- func (n *BackendNode) String() string
- func (n *BackendNode) Type() ir.Type
- func (n *BackendNode) UnaryOp(ctx ir.Evaluator, expr *ir.UnaryExpr) (evaluator.NumericalElement, error)
- func (n *BackendNode) Unflatten(handles *flatten.Parser) (values.Value, error)
- type Evaluator
- func (ev *Evaluator) ArrayOps() evaluator.ArrayOps
- func (ev *Evaluator) ElementFromAtom(ctx ir.Evaluator, src ir.AssignableExpr, val values.Array) (evaluator.NumericalElement, error)
- func (ev *Evaluator) ElementFromTuple(file *ir.File, expr ir.AssignableExpr, tpl ops.Tuple, shapes []*shape.Shape, ...) (ir.Element, error)
- func (ev *Evaluator) Importer() ir.Importer
- func (ev *Evaluator) Materialiser() materialise.Materialiser
- func (ev *Evaluator) NewArrayArgument(file *ir.File, parent parentArgument, typ ir.ArrayType, proxy ir.Element) (elements.ElementWithArrayFromContext, error)
- func (ev *Evaluator) NewFunc(itp *interp.Interpreter, fn ir.PkgFunc, recv *interp.Receiver) interp.Func
- func (ev *Evaluator) NewFuncLit(fitp *interp.FileScope, lit *ir.FuncLit) (interp.Func, error)
- func (ev *Evaluator) Processor() *processor.Processor
- func (ev *Evaluator) Trace(ctx ir.Evaluator, call *ir.CallExpr, args []ir.Element) error
- type SubGrapher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BackendNode ¶
type BackendNode struct {
// contains filtered or unexported fields
}
BackendNode is a state element owning a node in the backend graph.
func NewBackendNode ¶ added in v0.3.0
func NewBackendNode(ev *Evaluator, expr elements.ExprAt, node *ops.OutputNode) (*BackendNode, error)
NewBackendNode returns an element representing a node in the backend graph.
func (*BackendNode) BinaryOp ¶
func (n *BackendNode) BinaryOp(ctx ir.Evaluator, expr *ir.BinaryExpr, x, y evaluator.NumericalElement) (evaluator.NumericalElement, error)
BinaryOp applies a binary operator to x and y.
func (*BackendNode) Cast ¶
func (n *BackendNode) Cast(ctx ir.Evaluator, expr ir.AssignableExpr, target ir.Type) (evaluator.NumericalElement, error)
Cast an element into a given data type.
func (*BackendNode) Copy ¶
func (n *BackendNode) Copy() interp.Copier
Copy the node by returning itself.
func (*BackendNode) Materialise ¶
func (n *BackendNode) Materialise(materialise.Materialiser) (materialise.Node, error)
Materialise returns itself.
func (*BackendNode) OutNode ¶
func (n *BackendNode) OutNode() *ops.OutputNode
OutNode returns the graph node.
func (*BackendNode) Reshape ¶
func (n *BackendNode) Reshape(ctx ir.Evaluator, expr ir.AssignableExpr, axisLengths []evaluator.NumericalElement) (evaluator.NumericalElement, error)
Reshape an element into a given shape.
func (*BackendNode) Shape ¶
func (n *BackendNode) Shape() *shape.Shape
Shape returns the shape of the element.
func (*BackendNode) Slice ¶
func (n *BackendNode) Slice(fitp *interp.FileScope, expr *ir.IndexExpr, index evaluator.NumericalElement) (ir.Element, error)
Slice of the value on the first axis given an index.
func (*BackendNode) SliceArray ¶
func (n *BackendNode) SliceArray(fitp *interp.FileScope, expr ir.AssignableExpr, index evaluator.NumericalElement) (evaluator.NumericalElement, error)
SliceArray of the value on the first axis given an index.
func (*BackendNode) String ¶
func (n *BackendNode) String() string
String representation of the backend node.
func (*BackendNode) Type ¶ added in v0.3.0
func (n *BackendNode) Type() ir.Type
Type of the element.
func (*BackendNode) UnaryOp ¶
func (n *BackendNode) UnaryOp(ctx ir.Evaluator, expr *ir.UnaryExpr) (evaluator.NumericalElement, error)
UnaryOp applies a unary operator on x.
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
Evaluator evaluates GX operations by adding the corresponding node in the backend graph.
func (*Evaluator) ElementFromAtom ¶
func (ev *Evaluator) ElementFromAtom(ctx ir.Evaluator, src ir.AssignableExpr, val values.Array) (evaluator.NumericalElement, error)
ElementFromAtom returns an element from a GX value.
func (*Evaluator) ElementFromTuple ¶ added in v0.3.0
func (ev *Evaluator) ElementFromTuple(file *ir.File, expr ir.AssignableExpr, tpl ops.Tuple, shapes []*shape.Shape, targetType ir.Type) (ir.Element, error)
ElementFromTuple creates an interpreter element of a given type from a graph tuple.
func (*Evaluator) Materialiser ¶ added in v0.3.0
func (ev *Evaluator) Materialiser() materialise.Materialiser
Materialiser returns an array materialiser.
func (*Evaluator) NewArrayArgument ¶
func (ev *Evaluator) NewArrayArgument(file *ir.File, parent parentArgument, typ ir.ArrayType, proxy ir.Element) (elements.ElementWithArrayFromContext, error)
NewArrayArgument creates a new argument element that the graph can also use as an argument.
func (*Evaluator) NewFunc ¶
func (ev *Evaluator) NewFunc(itp *interp.Interpreter, fn ir.PkgFunc, recv *interp.Receiver) interp.Func
NewFunc creates a new function given its definition and a receiver.
func (*Evaluator) NewFuncLit ¶ added in v0.3.0
NewFuncLit creates a new function literal.