gorgonia: gorgonia.org/gorgonia/x/vm Index | Files

package xvm

import "gorgonia.org/gorgonia/x/vm"

Index

Package Files

chandb.go vm_gomachine.go

type GoMachine Uses

type GoMachine struct {
    // contains filtered or unexported fields
}

GoMachine is a computation VM for Gorgonia. Every edge of the graph is associated with a channel of Value. The channels are identified by two IDs, tail and head, which are the IDs of the starting node and the ending node.

Every node with a non-nil Op launches a goroutine.

Each goroutine is expecting Values from all of its input channels (those with a tail matching the current node's ID). Then it calls the Do method of the operator, sets the own node's Value (thanks to the `Let` function), and sends the Value to the output channel (the channels with a head matching the current node'ID).

Every input *Node, sends its Value to the channel with a tail matching its node ID and head matching a constant negative value.

func NewGoMachine Uses

func NewGoMachine(g *gorgonia.ExprGraph) *GoMachine

NewGoMachine creates a new VM able to run a program in a concurrent way. by now, only forward pass is supported

func (*GoMachine) Close Uses

func (g *GoMachine) Close() error

Close all channels

func (*GoMachine) Reset Uses

func (g *GoMachine) Reset()

Reset close all communication channels and created a new channel dictionary

func (*GoMachine) RunAll Uses

func (g *GoMachine) RunAll() error

RunAll triggers all the goroutines and wait for the all the output channel to be filled with a value.

Caution: there is no safety mechanism, and this method would never return (deadlock) in some circumstances.

Package xvm imports 3 packages (graph). Updated 2019-11-05. Refresh now. Tools for package owners.