inference

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: GPL-3.0, GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INFER_UNKNOWN = InferType(0)
	INFER_BY_IH   = InferType(1) // Infer By Input Hash
	INFER_BY_IC   = InferType(2) // Infer By Input Content
	GAS_BY_H      = InferType(3) // Gas By Model Hash
)
View Source
const (
	RES_OK    = "ok"
	RES_ERROR = "error"
)

infer response types

Variables

This section is empty.

Functions

func DumpToFile added in v1.0.0

func DumpToFile(fname string, data []byte) error

Types

type GasWork added in v1.0.0

type GasWork struct {
	Type  InferType `json:"type"`
	Model string    `json:"model"`
}

Infer by input content

type ICWork added in v1.0.0

type ICWork struct {
	Type  InferType     `json:"type"`
	Model string        `json:"model"`
	Input hexutil.Bytes `json:"input"`
}

Infer by input content

type IHWork added in v1.0.0

type IHWork struct {
	Type  InferType `json:"type"`
	Model string    `json:"model"`
	Input string    `json:"input"`
}

Infer by input info hash

type InferResult added in v1.0.0

type InferResult struct {
	Data hexutil.Bytes `json:"data"`
	Info string        `json:"info"`
}

type InferType added in v1.0.0

type InferType uint32

infer send types

func RetriveType added in v1.0.0

func RetriveType(input []byte) InferType

type NpyReader added in v1.0.0

type NpyReader struct {

	// The numpy data type of the array
	Dtype string

	// The endianness of the binary data
	Endian binary.ByteOrder

	// The version number of the file format
	Version int

	// The shape of the array as specified in the file.
	Shape []int

	// If true, the data are flattened in column-major order,
	// otherwise they are flattened in row-major order.
	ColumnMajor bool
	// contains filtered or unexported fields
}

NpyReader can read data from a Numpy binary array into a Go slice.

func NewBytesReader added in v1.0.0

func NewBytesReader(buff []byte) (*NpyReader, error)

func NewFileReader added in v1.0.0

func NewFileReader(f string) (*NpyReader, error)

NewFileReader is a convenience method returning a NpyReader that can be used to obtain array data from the given named file. Call one of the GetXXX methods to obtain the data slice.

func NewReader added in v1.0.0

func NewReader(r io.Reader) (*NpyReader, error)

NewReader returns a NpyReader that can be used to obtain array data as a Go slice. The Go slice has a type matching the dtype in the Numpy file. Call one of the GetXX methods to obtain the slice.

func (*NpyReader) GetBytes added in v1.0.0

func (rdr *NpyReader) GetBytes() ([]byte, error)

func (*NpyReader) GetFloat32 added in v1.0.0

func (rdr *NpyReader) GetFloat32() ([]float32, error)

GetFloat32 returns the array data as a slice of float32 values.

func (*NpyReader) GetFloat64 added in v1.0.0

func (rdr *NpyReader) GetFloat64() ([]float64, error)

GetFloat64 returns the array data as a slice of float64 values.

func (*NpyReader) GetInt16 added in v1.0.0

func (rdr *NpyReader) GetInt16() ([]int16, error)

GetInt16 returns the array data as a slice of int16 values.

func (*NpyReader) GetInt32 added in v1.0.0

func (rdr *NpyReader) GetInt32() ([]int32, error)

GetInt32 returns the array data as a slice of int32 values.

func (*NpyReader) GetInt64 added in v1.0.0

func (rdr *NpyReader) GetInt64() ([]int64, error)

GetInt64 returns the array data as a slice of int64 values.

func (*NpyReader) GetInt8 added in v1.0.0

func (rdr *NpyReader) GetInt8() ([]int8, error)

GetInt8 returns the array data as a slice of int8 values.

func (*NpyReader) GetUInt8 added in v1.0.0

func (rdr *NpyReader) GetUInt8() ([]uint8, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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