-
-
Notifications
You must be signed in to change notification settings - Fork 72
/
backend.go
27 lines (23 loc) · 733 Bytes
/
backend.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package onnx
import (
"gonum.org/v1/gonum/graph"
)
// Backend represent any backend able to receive a computation graph
type Backend interface {
OperationCarrier
graph.DirectedWeightedBuilder
}
// Operation defined by its name and its attribute
type Operation struct {
Name string
Attributes map[string]interface{}
}
// OperationCarrier should be a method of the graph
// because the operation needs the topology of the graph
// to check the arity of the node for example
type OperationCarrier interface {
// ApplyOperation on the graph nodes
// graph.Node is an array because it allows to handle multiple output
// for example a split operation returns n nodes...
ApplyOperation(Operation, ...graph.Node) error
}