kernel

package
v1.9.57-beta Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: GPL-3.0, GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SUCCEED       = int(C.SUCCEED)
	ERROR_LOGIC   = int(C.ERROR_LOGIC)
	ERROR_RUNTIME = int(C.ERROR_RUNTIME)
)

Functions

func GetModelGasFromGraphFile

func GetModelGasFromGraphFile(lib *LibCVM, json []byte) (gas uint64, status int)

func SwitchEndian

func SwitchEndian(data []byte, bytes int) ([]byte, error)

func ToAlignedData

func ToAlignedData(data []byte, bytes int) ([]byte, error)

Types

type LibCVM

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

func LibOpen

func LibOpen(libpath string) (*LibCVM, int)

func (*LibCVM) FreeModel

func (l *LibCVM) FreeModel(net unsafe.Pointer) int

func (*LibCVM) GetGasFromGraphFile

func (l *LibCVM) GetGasFromGraphFile(json []byte) (uint64, int)

func (*LibCVM) GetGasFromModel

func (l *LibCVM) GetGasFromModel(net unsafe.Pointer) (uint64, int)

func (*LibCVM) GetInputLength

func (l *LibCVM) GetInputLength(net unsafe.Pointer) (uint64, int)

func (*LibCVM) GetInputTypeSize

func (l *LibCVM) GetInputTypeSize(net unsafe.Pointer) (uint64, int)

func (*LibCVM) GetOutputLength

func (l *LibCVM) GetOutputLength(net unsafe.Pointer) (uint64, int)

func (*LibCVM) GetOutputTypeSize

func (l *LibCVM) GetOutputTypeSize(net unsafe.Pointer) (uint64, int)

func (*LibCVM) GetPreprocessMethod

func (l *LibCVM) GetPreprocessMethod(net unsafe.Pointer) ([34]byte, int)

func (*LibCVM) GetStorageSize

func (l *LibCVM) GetStorageSize(net unsafe.Pointer) (uint64, int)

func (*LibCVM) GetVersion

func (l *LibCVM) GetVersion(net unsafe.Pointer) ([34]byte, int)

version and method string length not greater than 32

func (*LibCVM) Inference

func (l *LibCVM) Inference(net unsafe.Pointer, input []byte) ([]byte, int)

func (*LibCVM) LoadModel

func (l *LibCVM) LoadModel(modelCfg, modelBin []byte,
	deviceType, deviceId int) (unsafe.Pointer, int)

type Model

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

func New

func New(lib *LibCVM, modelCfg, modelBin []byte, deviceType, deviceId int) (*Model, int)

func (*Model) Free

func (m *Model) Free() int

func (*Model) GetInputLength

func (m *Model) GetInputLength() uint64

func (*Model) Ops

func (m *Model) Ops() uint64

func (*Model) Predict

func (m *Model) Predict(data []byte) ([]byte, int)

func (*Model) Size

func (m *Model) Size() uint64

Jump to

Keyboard shortcuts

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