Documentation
¶
Overview ¶
Example ¶
package main import ( "fmt" . "gorgonia.org/golgi" "gorgonia.org/gorgonia" "gorgonia.org/tensor" ) func softmax(a *gorgonia.Node) (*gorgonia.Node, error) { return gorgonia.SoftMax(a) } func main() { n := 100 of := tensor.Float64 g := gorgonia.NewGraph() x := gorgonia.NewTensor(g, of, 4, gorgonia.WithName("X"), gorgonia.WithShape(n, 1, 28, 28), gorgonia.WithInit(gorgonia.GlorotU(1))) y := gorgonia.NewMatrix(g, of, gorgonia.WithName("Y"), gorgonia.WithShape(n, 10), gorgonia.WithInit(gorgonia.GlorotU(1))) nn, err := ComposeSeq( x, L(ConsReshape, ToShape(n, 784)), L(ConsFC, WithSize(50), WithName("l0"), AsBatched(true), WithActivation(gorgonia.Tanh), WithBias(true)), L(ConsDropout, WithProbability(0.5)), L(ConsFC, WithSize(150), WithName("l1"), AsBatched(true), WithActivation(gorgonia.Rectify)), // by default WithBias is true L(ConsLayerNorm, WithSize(20), WithName("Norm"), WithEps(0.001)), L(ConsFC, WithSize(10), WithName("l2"), AsBatched(true), WithActivation(softmax), WithBias(false)), ) if err != nil { panic(err) } out := nn.Fwd(x) if err = gorgonia.CheckOne(out); err != nil { panic(err) } cost := gorgonia.Must(RMS(out, y)) model := nn.Model() if _, err = gorgonia.Grad(cost, model...); err != nil { panic(err) } m := gorgonia.NewTapeMachine(g) if err := m.RunAll(); err != nil { panic(err) } fmt.Printf("Model: %v\n", model) }
Output: Model: [l0_W, l0_B, l1_W, l1_B, Norm_W, Norm_B, l2_W]
Example (Extension) ¶
package main import ( "fmt" "github.com/pkg/errors" . "gorgonia.org/golgi" G "gorgonia.org/gorgonia" "gorgonia.org/tensor" ) // myLayer is a layer with additional support for transformation for shapes. // // One may of course do this with a ComposeSeq(Reshape, FC), but this is just for demonstration purposes type myLayer struct { // name is in FC FC // BE CAREFUL WITH EMBEDDINGS // size is in FC and in myLayer size int } // Model, Name, Type, Shape and Describe are all from the embedded FC func (l *myLayer) Fwd(a G.Input) G.Result { if err := G.CheckOne(a); err != nil { return G.Err(errors.Wrapf(err, "Fwd of myLayer %v", l.FC.Name())) } x := a.Node() xShape := x.Shape() switch xShape.Dims() { case 0, 1: return G.Err(errors.Errorf("Unable to handle x of %v", xShape)) case 2: return l.FC.Fwd(x) case 3, 4: return G.Err(errors.Errorf("NYI")) } panic("UNIMPLEMENTED") } func ConsMyLayer(x G.Input, opts ...ConsOpt) (retVal Layer, err error) { l := new(myLayer) for _, opt := range opts { var o Layer var ok bool if o, err = opt(l); err != nil { return nil, err } if l, ok = o.(*myLayer); !ok { return nil, errors.Errorf("Construction Option returned non *myLayer. Got %T instead", o) } } if err = l.Init(x.(*G.Node)); err != nil { return nil, err } return l, nil } func main() { of := tensor.Float64 g := G.NewGraph() x := G.NewTensor(g, of, 4, G.WithName("X"), G.WithShape(100, 1, 28, 28), G.WithInit(G.GlorotU(1))) layer, err := ConsMyLayer(x, WithName("EXT"), WithSize(100)) if err != nil { fmt.Printf("Uh oh. Error happened when constructing *myLayer: %v\n", err) } l, _ := layer.(*myLayer) fmt.Printf("Name: %q\n", l.Name()) fmt.Printf("Model: %v\n", l.Model()) fmt.Printf("BE CAREFUL\n======\nl.size is %v. But the models shapes are correct as follows:\n", l.size) for _, n := range l.Model() { fmt.Printf("\t%v - %v\n", n.Name(), n.Shape()) } }
Output: Name: "EXT" Model: [EXT_W, EXT_B] BE CAREFUL ====== l.size is 0. But the models shapes are correct as follows: EXT_W - (1, 100) EXT_B - (100, 100)
Index ¶
- func BroadcastAdd(a, b *G.Node, leftPattern, rightPattern []byte) (*G.Node, error)
- func BroadcastEq(a, b *G.Node, retSame bool, leftPattern, rightPattern []byte) (*G.Node, error)
- func BroadcastGt(a, b *G.Node, retSame bool, leftPattern, rightPattern []byte) (*G.Node, error)
- func BroadcastGte(a, b *G.Node, retSame bool, leftPattern, rightPattern []byte) (*G.Node, error)
- func BroadcastHadamardDiv(a, b *G.Node, leftPattern, rightPattern []byte) (*G.Node, error)
- func BroadcastHadamardProd(a, b *G.Node, leftPattern, rightPattern []byte) (*G.Node, error)
- func BroadcastLt(a, b *G.Node, retSame bool, leftPattern, rightPattern []byte) (*G.Node, error)
- func BroadcastLte(a, b *G.Node, retSame bool, leftPattern, rightPattern []byte) (*G.Node, error)
- func BroadcastNe(a, b *G.Node, retSame bool, leftPattern, rightPattern []byte) (*G.Node, error)
- func BroadcastPow(a, b *G.Node, leftPattern, rightPattern []byte) (*G.Node, error)
- func BroadcastSub(a, b *G.Node, leftPattern, rightPattern []byte) (*G.Node, error)
- func ExtractMetadata(opts ...ConsOpt) (retVal Metadata, unused []ConsOpt, err error)
- func GeLUFn(a *G.Node) (*G.Node, error)
- func RMS(yHat, y G.Input) (retVal *G.Node, err error)
- func SoftMaxFn(a *G.Node) (*G.Node, error)
- type Activation
- type ActivationFunction
- type ByNamer
- type Composition
- func (l *Composition) ByName(name string) Term
- func (l *Composition) Describe()
- func (l *Composition) FLOPs() (retVal int)
- func (l *Composition) Fwd(a G.Input) (output G.Result)
- func (l *Composition) Graph() *G.ExprGraph
- func (l *Composition) Model() (retVal G.Nodes)
- func (l *Composition) Name() string
- func (l *Composition) Runners() []Runner
- type ConsOpt
- func AsBatched(batched bool) ConsOpt
- func AsRunner() ConsOpt
- func ComputeFLOPs(toCompute bool) ConsOpt
- func Of(dt tensor.Dtype) ConsOpt
- func ToShape(shp ...int) ConsOpt
- func WithActivation(act ActivationFunction) ConsOpt
- func WithBatchSize(bs int) ConsOpt
- func WithBias(withbias bool) ConsOpt
- func WithClasses(classes int) ConsOpt
- func WithConst(c *G.Node) ConsOpt
- func WithDilation(s []int) ConsOpt
- func WithEps(eps float64) ConsOpt
- func WithKernelShape(s tensor.Shape) ConsOpt
- func WithName(name string) ConsOpt
- func WithOneHotInput() ConsOpt
- func WithPad(p []int) ConsOpt
- func WithProbability(prob float64) ConsOpt
- func WithSize(size ...int) ConsOpt
- func WithStride(s []int) ConsOpt
- func WithWB(w, b *G.Node) ConsOpt
- func WithWeights(w *G.Node) ConsOpt
- type Conv
- func (l *Conv) Describe()
- func (l *Conv) FLOPs() int
- func (l *Conv) Fwd(x gorgonia.Input) gorgonia.Result
- func (l *Conv) Init(xs ...*gorgonia.Node) (err error)
- func (l *Conv) Model() gorgonia.Nodes
- func (l *Conv) Name() string
- func (l *Conv) SetActivationFn(act ActivationFunction) error
- func (l *Conv) SetDropout(d float64) error
- func (l *Conv) SetName(n string) error
- func (l *Conv) SetSize(s ...int) error
- func (l *Conv) Shape() tensor.Shape
- func (l *Conv) Type() hm.Type
- type Data
- type Embedding
- func (l *Embedding) Describe()
- func (l *Embedding) Fwd(a G.Input) G.Result
- func (l *Embedding) Graph() *G.ExprGraph
- func (l *Embedding) Init(xs ...*G.Node) (err error)
- func (l *Embedding) IsInitialized() bool
- func (l *Embedding) Model() G.Nodes
- func (l *Embedding) Name() string
- func (l *Embedding) Run(input G.Input) (err error)
- func (l *Embedding) Runners() []Runner
- type Env
- type FC
- func (l *FC) ByName(name string) Term
- func (l *FC) Describe()
- func (l *FC) FLOPs() int
- func (l *FC) Fwd(a G.Input) G.Result
- func (l *FC) Graph() *G.ExprGraph
- func (l *FC) Init(xs ...*G.Node) (err error)
- func (l *FC) IsInitialized() bool
- func (l *FC) Model() G.Nodes
- func (l *FC) Name() string
- func (l *FC) SetAct(act ActivationFunction) error
- func (l *FC) SetComputeFLOPs(toCompute bool) error
- func (l *FC) SetName(a string) error
- func (l *FC) SetSize(a int) error
- func (l *FC) Shape() tensor.Shape
- func (l *FC) Type() hm.Type
- type Grapher
- type I
- type Join
- type LSTM
- type LSTMData
- type Layer
- func ConsConv(in gorgonia.Input, opts ...ConsOpt) (retVal Layer, err error)
- func ConsDropout(_ G.Input, opts ...ConsOpt) (l Layer, err error)
- func ConsEmbedding(in G.Input, opts ...ConsOpt) (retVal Layer, err error)
- func ConsFC(in G.Input, opts ...ConsOpt) (retVal Layer, err error)
- func ConsLSTM(in G.Input, opts ...ConsOpt) (retVal Layer, err error)
- func ConsLayerNorm(in G.Input, opts ...ConsOpt) (retVal Layer, err error)
- func ConsMaxPool(in gorgonia.Input, opts ...ConsOpt) (retVal Layer, err error)
- func ConsReshape(_ G.Input, opts ...ConsOpt) (l Layer, err error)
- func ConsSkip(_ G.Input, opts ...ConsOpt) (retVal Layer, err error)
- func MakeLayerNorm(opts ...ConsOpt) Layer
- func NewLayerNorm(opts ...ConsOpt) Layer
- func Redefine(l Layer, opts ...ConsOpt) (retVal Layer, err error)
- type LayerCons
- type MaxPool
- func (l *MaxPool) Describe()
- func (l *MaxPool) FLOPs() int
- func (l *MaxPool) Fwd(x gorgonia.Input) gorgonia.Result
- func (l *MaxPool) Init(xs ...*gorgonia.Node) (err error)
- func (l *MaxPool) Model() gorgonia.Nodes
- func (l *MaxPool) Name() string
- func (l *MaxPool) SetComputeFLOPs(toCompute bool) error
- func (l *MaxPool) SetDropout(d float64) error
- func (l *MaxPool) SetName(n string) error
- func (l *MaxPool) SetSize(s int) error
- func (l *MaxPool) Type() hm.Type
- type Metadata
- func (m *Metadata) Describe()
- func (m *Metadata) Fwd(x G.Input) G.Result
- func (m *Metadata) Model() G.Nodes
- func (m *Metadata) Name() string
- func (m *Metadata) PassThru()
- func (m *Metadata) SetActivationFn(act ActivationFunction) error
- func (m *Metadata) SetName(name string) error
- func (m *Metadata) SetSize(size int) error
- func (m *Metadata) Shape() tensor.Shape
- func (m *Metadata) Type() hm.Type
- type Name
- type Pass
- type ReshapeFn
- type Runner
- type Runnerser
- type Term
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BroadcastAdd ¶
BroadcastAdd performs a add. The operation is precomposed with a broadcast such that the shapes matches before operations commence.
func BroadcastEq ¶
BroadcastEq performs a eq. The operation is precomposed with a broadcast such that the shapes matches before operations commence.
func BroadcastGt ¶
BroadcastGt performs a gt. The operation is precomposed with a broadcast such that the shapes matches before operations commence.
func BroadcastGte ¶
BroadcastGte performs a gte. The operation is precomposed with a broadcast such that the shapes matches before operations commence.
func BroadcastHadamardDiv ¶
BroadcastHadamardDiv performs a hadamarddiv. The operation is precomposed with a broadcast such that the shapes matches before operations commence.
func BroadcastHadamardProd ¶
BroadcastHadamardProd performs a hadamardprod. The operation is precomposed with a broadcast such that the shapes matches before operations commence.
func BroadcastLt ¶
BroadcastLt performs a lt. The operation is precomposed with a broadcast such that the shapes matches before operations commence.
func BroadcastLte ¶
BroadcastLte performs a lte. The operation is precomposed with a broadcast such that the shapes matches before operations commence.
func BroadcastNe ¶
BroadcastNe performs a ne. The operation is precomposed with a broadcast such that the shapes matches before operations commence.
func BroadcastPow ¶
BroadcastPow performs a pow. The operation is precomposed with a broadcast such that the shapes matches before operations commence.
func BroadcastSub ¶
BroadcastSub performs a sub. The operation is precomposed with a broadcast such that the shapes matches before operations commence.
func ExtractMetadata ¶
ExtractMetadata extracts common metadata from a list of ConsOpts. It returns the metadata. Any unused ConsOpt is also returned. This allows users to selectively use the metadata and/or ConsOpt options
func GeLUFn ¶
GeLUFn is an activation function. See https://arxiv.org/abs/1606.08415.
Types ¶
type Activation ¶
type Activation int
Activation represents the types of ActivationFunctions that Golgi understands.
The Activation type is useful as it allows the models to be serialized (you cannot serialize ActivationFunction). Use ActivationMap() to get the relevant ActivationFunction.
const ( Identity Activation = iota Sigmoid Tanh ReLU GeLU LeakyReLU ELU Cube SoftMax )
type ActivationFunction ¶
ActivationFunction represents an activation function Note: This may become an interface once we've worked through all the linter errors
func ActivationMap ¶
func ActivationMap(a Activation) ActivationFunction
ActivationMap is a map from Activation to ActivationFunction. The mapping function is finite. If an invalid Activation is passed in, nil will be returned.
type ByNamer ¶
ByNamer is any type that allows a name to be found and returned.
If a name is not found, `nil` is to be returned
type Composition ¶
type Composition struct {
// contains filtered or unexported fields
}
Composition (∘) represents a composition of functions.
The semantics of ∘(a, b)(x) is b(a(x)).
func Compose ¶
func Compose(a, b Term) (retVal *Composition)
Compose creates a composition of terms.
func ComposeSeq ¶
func ComposeSeq(layers ...Term) (retVal *Composition, err error)
ComposeSeq creates a composition with the inputs written in left to right order
The equivalent in F# is |>. The equivalent in Haskell is (flip (.))
func (*Composition) ByName ¶
func (l *Composition) ByName(name string) Term
ByName returns a Term by name
func (*Composition) Describe ¶
func (l *Composition) Describe()
Describe will describe a composition
func (*Composition) FLOPs ¶
func (l *Composition) FLOPs() (retVal int)
func (*Composition) Fwd ¶
func (l *Composition) Fwd(a G.Input) (output G.Result)
Fwd runs the equation forwards
func (*Composition) Graph ¶
func (l *Composition) Graph() *G.ExprGraph
func (*Composition) Model ¶
func (l *Composition) Model() (retVal G.Nodes)
Model will return the gorgonia.Nodes associated with this composition
func (*Composition) Name ¶
func (l *Composition) Name() string
Name will return the name of the composition
func (*Composition) Runners ¶
func (l *Composition) Runners() []Runner
type ConsOpt ¶
ConsOpt is a construction option for layers
func AsBatched ¶
AsBatched defines a layer that performs batched operation or not. By default most layers in this package are batched.
func ComputeFLOPs ¶
ComputeFLOPs tells the layer to also compute FLOPS as the input is forwarded through it.
func WithActivation ¶
func WithActivation(act ActivationFunction) ConsOpt
WithActivation sets the activation function of a layer
func WithBatchSize ¶
WithBatchSize creates a layer with a given batch size.
func WithClasses ¶
WithClasses is a construction option that specifies how many classes are there in the embedding layer.
func WithDilation ¶
WithDilation sets the dilation for convolution layers
func WithKernelShape ¶
WithKernelShape sets the kernel shape for convolution layers (Conv, MaxPool)
func WithName ¶
WithName creates a layer that is named.
If the layer is unnameable (i.e. trivial layers), then there is no effect.
func WithOneHotInput ¶
func WithOneHotInput() ConsOpt
WithOneHotInput is a construction option for a *Embedding that specifiess the behaviour to accept one-hot-vector/matrix as input.
func WithProbability ¶
WithProbability is a ConsOpt for Dropout only.
func WithStride ¶
WithStride sets the stride for convolution layers (Conv, MaxPool)
func WithWeights ¶
WithWeights constructs a layer with the given weights.
type Conv ¶
type Conv struct {
// contains filtered or unexported fields
}
Conv represents a convolution layer
func (*Conv) SetActivationFn ¶
func (l *Conv) SetActivationFn(act ActivationFunction) error
SetActivationFn sets the activation function of the layer
func (*Conv) SetDropout ¶
SetDropout sets the dropout of the layer
type Embedding ¶
type Embedding struct {
// contains filtered or unexported fields
}
Embedding is a layer that represents an embedding layer.
An embedding layer is essentially a matrix of the shape (classes, dimensions). While the Embedding layer can be done by means of using FC, this provides some ease of use.
Specifically the Embedding layer supports forwarding of an input that is a slice of classes.
Let us look at a word-based example, consider the vocab size to be the number of classes. The classical word embedding then is simply a (vocab, dims) matrix. Let's set the dims to be 50. For simplicity, let's set the vocab to 10. So that the embedding matrix W is a (10, 50) matrix.
W := ⸢w1_1 ... w1_50⸣ ⋮ ⸤w10_1 ... w10_50⸥
To select a word vector, we simply slice the matrix. For example, to get the vector of word ID 2, we slice W[2]. This gives us a 50-dimension vector:
W[2] = [w2_1 ... w2_50]
We can equally do this by multiplying the matrix with a one-hot vector. A vector O given as
O := [0 0 1 0 0 0 0 0 0 0]
when multiplied against W, will yield the same result as W[2].
The usual way of selecting from a embedding matrix with a one-hot vector is quite cumbersome. This struct makes it easy.
You can pass in a *tensor.Dense of qol.Class:
wv := tensor.New(tensor.WithBacking([]qol.Class{4, 10, 0, 0, 0, 0, 0, 0,0,0})) words := gorgonia.NewVector(g, gorgonia.WithShape(10), gorgonia.WithValue(wv)) layer.Fwd(words)
The Embedding layer's Fwd function will automatically transform a slice of classes into a one-hot matrix to be multiplied with.
func NewEmbedding ¶
NewEmbedding creates a new embedding layer.
func (*Embedding) Graph ¶
Graph returns the underlying computation graph. Embedding implements Grapher.
func (*Embedding) IsInitialized ¶
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
Env is a linked list representing an environment. Within the documentation, an environment is written as such:
e := (x ↦ X)
`x` is the name while `X` is the *gorgonia.Node
A longer environment may look like this:
e2 := (x ↦ X :: y ↦ Y) ^
Here, e2 is pointing to the *Env that contains (y ↦ Y).
When talking about Envs in general, it will often be written as a meta variable σ.
func (*Env) ByName ¶
ByName returns the first node that matches the given name. It also returns the parent
For example, if we have an Env as follows:
e := (x ↦ X1 :: w ↦ W :: x ↦ X2) ^
The caret indicates the pointer of *Env. Now, if e.ByName("x") is called, then the result returned will be X2 and (x ↦ X1 :: w ↦ W)
func (*Env) Extend ¶
Extend allows users to extend the environment.
Given an environment as follows:
e := (x ↦ X)
if `e.Extend(y, Y)` is called, the following is returned
e2 := (x ↦ X :: y ↦ Y) ^
The pointer will be pointing to the *Env starting at y
func (*Env) HintedModel ¶
HintedModel will return the gorgonia.Nodes hinted associated with this environment
type FC ¶
type FC struct {
// contains filtered or unexported fields
}
FC represents a fully connected layer
If batched is set to true, then the first dimension is assumed to be the batch dimension
func (*FC) IsInitialized ¶
IsInitialized returns true if it has been initialized. This allows lazy initialization to be supported
func (*FC) SetAct ¶
func (l *FC) SetAct(act ActivationFunction) error
SetAct will set an activiation function of a fully connected layer
func (*FC) SetComputeFLOPs ¶
SetComputeFLOPs will set the `computeFLOPs` param. If true then the FLOPs will be computed when the input is forwarded.
type Join ¶
type Join struct { Composition // contains filtered or unexported fields }
Join joins are generalized compositions.
func HadamardProd ¶
HadamardProd performs a elementwise multiplicatoin on the results of two layers/terms.
type LSTM ¶
type LSTM struct {
// contains filtered or unexported fields
}
LSTM represents an LSTM RNN
func FromLSTMData ¶
FromLSTMData will initialize a new LSTM model
func (*LSTM) Fwd ¶
Fwd runs the equation forwards.
While a *LSTM can take any gorgonia.Input as an input, it returns a gorgonia.Result, of which the concrete type is a lstimIO.
The lstmIO type is not exported. Instead, to query the *Node of the gorgonia.Input or gorgonia.Result, use the Nodes() method.
The Result will always be organized as such: [previousHidden, previousCell]
e.g.
out := lstm.Fwd(x) outNodes := out.Nodes() prevHidden := outNodes[0] prevCell := outNodes[1]
type LSTMData ¶
type LSTMData struct {
// contains filtered or unexported fields
}
LSTMData represents a basic LSTM layer
type Layer ¶
type Layer interface { // σ - The weights are the "free variables" of a function Model() G.Nodes // Fwd represents the forward application of inputs // x.t Fwd(x G.Input) G.Result Term // Describe returns the protobuf definition of a Layer that conforms to the ONNX standard Describe() // some protobuf things TODO }
Layer represents a neural network layer. λ
func ConsConv ¶
ConsConv is a Conv construction function. It takes a gorgonia.Input that has a *gorgonia.Node. Defaults:
activation function: Rectify kernel shape: (5,5) pad: (1,1) stride: (1,1) dilation: (1,1)
func ConsDropout ¶
ConsDropout creates a dropout layer. It ignores the `x` input
func ConsEmbedding ¶
ConsEmbedding is a construction function to construct a *Embedding. This is typically used in a L() construction manner.
func ConsFC ¶
ConsFC is a FC construction function. It takes a gorgonia.Input that has a *gorgonia.Node.
func ConsLSTM ¶
ConsLSTM is a LSTM construction function. It takes a gorgonia.Input that has a *gorgonia.Node.
func ConsLayerNorm ¶
ConsLayerNorm is a construction function for a layer normalization layer. `in` has to be at least a *gorgonia.Node
func ConsMaxPool ¶
ConsMaxPool is a MaxPool construction function. It takes a gorgonia.Input that has a *gorgonia.Node. Defaults:
kernel shape: (2,2) pad: (0,0) stride: (2,2)
func ConsReshape ¶
ConsReshape is a construction function for a reshaping layer. It ignores the `x` input.
func MakeLayerNorm ¶
func NewLayerNorm ¶
NewLayerNorm creates a layer-normalization layer. It does not initialize the layer.
type MaxPool ¶
type MaxPool struct {
// contains filtered or unexported fields
}
MaxPool represents a MaxPoololution layer
func NewMaxPool ¶
func (*MaxPool) Describe ¶
func (l *MaxPool) Describe()
Describe will describe a MaxPoololution layer
func (*MaxPool) Model ¶
Model will return the gorgonia.Nodes associated with this MaxPoololution layer
func (*MaxPool) SetComputeFLOPs ¶
func (*MaxPool) SetDropout ¶
SetDropout sets the dropout of the layer
type Metadata ¶
type Metadata struct { Size int ActivationFn ActivationFunction // contains filtered or unexported fields }
Metadata is not a real Layer. Its main aims is to extract metadata such as name or size from ConsOpts. This is useful in cases where the metadata needs to be composed as well. Note that the fields may end up being all empty.
func (*Metadata) Name ¶
Name returns the name. Conveniently, this makes *Metadata fulfil the Layer interface, so we may use it to extract the desired metadata. Unfortunately this also means that the name is not an exported field. A little inconsistency there.
func (*Metadata) SetActivationFn ¶
func (m *Metadata) SetActivationFn(act ActivationFunction) error
SetActivationFn allows the metadata to store activation function.
type Pass ¶
type Pass interface {
PassThru()
}
Pass represents layers that are pass-thru - layers that have external effects that do not affect the expression graph.
type Runnerser ¶
type Runnerser interface {
Runners() []Runner
}
Runnerser is any kind of layer that gets a slice of Runners.
For simplicity, all Runners should implement Runnerser