mxnet

package
v0.3.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CPU_DEVICE = iota + 1 // cpu device type
	GPU_DEVICE            // gpu device type
)

Variables

This section is empty.

Functions

func GetLastError

func GetLastError() error

get the last error happeneed. go binding for MXGetLastError

Types

type Device

type Device struct {
	Type int // device type
	Id   int // device id
}

TODO higher level api like context

type InputNode

type InputNode struct {
	Key   string   // name
	Shape []uint32 // shape of ndarray
}

type NDItem

type NDItem struct {
	Key   string    // name of ndarray
	Data  []float32 // actual data of ndarray
	Shape []uint32  // shape
	Ndim  uint32    // the number of dimension in the shape
	Size  uint32    // Shape[0]*Shape[1]....Shape[Ndim-1]
}

NDArray operator

type NDList

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

NDArray List operator

func CreateNDListFromBytes

func CreateNDListFromBytes(b []byte) (*NDList, error)

create NDList from bytes go binding for MXNDListCreate MXNDListCreate will load ndarrays from file data

func CreateNDListFromFile

func CreateNDListFromFile(filepath string) (*NDList, error)

create NDList from file go binding for MXNDListCreate MXNDListCreate will load ndarrays from file data

func (*NDList) Free

func (s *NDList) Free() error

free this NDList's C handle go binding for MXNDListFree

func (*NDList) Get

func (s *NDList) Get(index uint32) (*NDItem, error)

get an element from ndarray list go binding for MXNDListGet

type Predictor

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

predictor for inference

func CreatePredictor

func CreatePredictor(symbol []byte,
	params []byte,
	device Device,
	nodes []InputNode,
) (*Predictor, error)

Create a Predictor go binding for MXPredCreate param symbol The JSON string of the symbol param params In-memory raw bytes of parameter ndarray file param device Device to run predictor param nodes An array of InputNode which stored the name and shape data of ndarray item

func CreatePredictorPartial

func CreatePredictorPartial(symbol []byte,
	params []byte,
	device Device,
	nodes []InputNode,
	outputKey string,
) (*Predictor, error)

CreatePredictorPartial Creates a Predictor wich customized outputs [layer] go binding for MXPredCreate param symbol The JSON string of the symbol param params In-memory raw bytes of parameter ndarray file param device Device to run predictor param nodes An array of InputNode which stored the name and shape data of ndarray item param outputKey the name of the output layer/key

func (*Predictor) Forward

func (s *Predictor) Forward() error

run a forward pass after SetInput go binding for MXPredForward

func (*Predictor) Free

func (s *Predictor) Free() error

free this predictor's C handle go binding for MXPredFree

func (*Predictor) GetOutput

func (s *Predictor) GetOutput(index uint32) ([]float32, error)

get the output value of prediction go binding for MXPredGetOutput param index The index of output node, set to 0 if there is only one output

func (*Predictor) GetOutputShape

func (s *Predictor) GetOutputShape(index uint32) ([]uint32, error)

get the shape of output node go binding for MXPredGetOutputShape param index The index of output node, set to 0 if there is only one output

func (*Predictor) SetInput

func (s *Predictor) SetInput(key string, data []float32) error

set the input data of predictor go binding for MXPredSetInput param key The name of input node to set param data The float data to be set

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL