Documentation ¶
Index ¶
- Constants
- func DumpToFile(fname string, data []byte) error
- type ICWork
- type IHWork
- type InferResult
- type InferType
- type Inference
- type NpyReader
- func (rdr *NpyReader) GetBytes() ([]byte, error)
- func (rdr *NpyReader) GetFloat32() ([]float32, error)
- func (rdr *NpyReader) GetFloat64() ([]float64, error)
- func (rdr *NpyReader) GetInt16() ([]int16, error)
- func (rdr *NpyReader) GetInt32() ([]int32, error)
- func (rdr *NpyReader) GetInt64() ([]int64, error)
- func (rdr *NpyReader) GetInt8() ([]int8, error)
- func (rdr *NpyReader) GetUInt8() ([]uint8, error)
Constants ¶
const ( INFER_UNKNOWN = InferType(0) INFER_BY_IH = InferType(1) // Infer By Input Hash INFER_BY_IC = InferType(2) // Infer By Input Content )
const ( RES_OK = "ok" RES_ERROR = "error" )
infer response types
Variables ¶
This section is empty.
Functions ¶
func DumpToFile ¶ added in v1.0.0
Types ¶
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 InferType ¶ added in v1.0.0
type InferType uint32
infer send types
func RetriveType ¶ added in v1.0.0
type Inference ¶
type Inference interface { VerifyModel(modelInfoHash string) error VerifyInput(inputInfoHash string) error // Infer procedure may be blocked with I/O, infernet, network, etc. // It should be designed with returning result to make thread be killed internal possible InferByInfoHash(modelInfoHash, inputInfoHash string) ([]byte, error) InferByInputContent(modelInfoHash string, inputContent []byte) ([]byte, error) RemoteInferByInfoHash(modelInfoHash, inputInfoHash, uri string) ([]byte, error) RemoteInferByInputContent(modelInfoHash, uri string, inputContent []byte) ([]byte, error) }
Inference Engine Interface
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 NewFileReader ¶ added in v1.0.0
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
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) GetFloat32 ¶ added in v1.0.0
GetFloat32 returns the array data as a slice of float32 values.
func (*NpyReader) GetFloat64 ¶ added in v1.0.0
GetFloat64 returns the array data as a slice of float64 values.
func (*NpyReader) GetInt16 ¶ added in v1.0.0
GetInt16 returns the array data as a slice of int16 values.
func (*NpyReader) GetInt32 ¶ added in v1.0.0
GetInt32 returns the array data as a slice of int32 values.
func (*NpyReader) GetInt64 ¶ added in v1.0.0
GetInt64 returns the array data as a slice of int64 values.