Documentation ¶
Index ¶
- Constants
- func DumpToFile(fname string, data []byte) error
- type AvailableWork
- type GasWork
- type ICWork
- type IHWork
- type InferResult
- type InferType
- type NpyReader
- func (rdr *NpyReader) GetBytes() ([]byte, error)
- func (rdr *NpyReader) GetComplex128() ([]complex128, error)
- func (rdr *NpyReader) GetComplex64() ([]complex64, 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) GetUint16() ([]uint16, error)
- func (rdr *NpyReader) GetUint32() ([]uint32, error)
- func (rdr *NpyReader) GetUint64() ([]uint64, error)
- func (rdr *NpyReader) GetUint8() ([]uint8, error)
- type NpyWriter
- func (wtr *NpyWriter) WriteComplex128(data []complex128) error
- func (wtr *NpyWriter) WriteComplex64(data []complex64) error
- func (wtr *NpyWriter) WriteFloat32(data []float32) error
- func (wtr *NpyWriter) WriteFloat64(data []float64) error
- func (wtr *NpyWriter) WriteInt16(data []int16) error
- func (wtr *NpyWriter) WriteInt32(data []int32) error
- func (wtr *NpyWriter) WriteInt64(data []int64) error
- func (wtr *NpyWriter) WriteInt8(data []int8) error
- func (wtr *NpyWriter) WriteUint16(data []uint16) error
- func (wtr *NpyWriter) WriteUint32(data []uint32) error
- func (wtr *NpyWriter) WriteUint64(data []uint64) error
- func (wtr *NpyWriter) WriteUint8(data []uint8) error
- type Work
Constants ¶
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 AVAILABLE_BY_H = InferType(4) // Available by info hash )
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 AvailableWork ¶ added in v1.9.51
type AvailableWork struct { Type InferType `json:"type"` InfoHash string `json:"infohash"` RawSize int64 `json:"rawSize"` }
check Available
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 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 NewFileReader ¶ added in v1.0.0
NewFileReader returns 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 as a Go 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) GetComplex128 ¶ added in v1.9.51
func (rdr *NpyReader) GetComplex128() ([]complex128, error)
GetComplex128 returns the array data as a slice of complex128 values.
func (*NpyReader) GetComplex64 ¶ added in v1.9.51
GetComplex64 returns the array data as a slice of complex64 values.
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.
func (*NpyReader) GetInt8 ¶ added in v1.0.0
GetInt8 returns the array data as a slice of int8 values.
func (*NpyReader) GetUint16 ¶ added in v1.9.51
GetUint16 returns the array data as a slice of uint16 values.
func (*NpyReader) GetUint32 ¶ added in v1.9.51
GetUint32 returns the array data as a slice of uint32 values.
type NpyWriter ¶ added in v1.9.51
type NpyWriter struct { // Defaults to little endian, but can be set to // binary.BigEndian before writing data Endian binary.ByteOrder // Defaults to nx1, where n is the length of data. Can be set // to any shape with any number of dimensions. The shape is // not checked for compatibility with the data. Shape []int // Defaults to false (row major order), can be set to true // (column major order) before writing the data. ColumnMajor bool // Defaults to 1, can be set to 2 before writing the data. Version int // contains filtered or unexported fields }
NpyWriter can write data from a Go slice to a Numpy binary array.
func NewFileWriter ¶ added in v1.9.51
NewFileWriter returns a NpyWriter that can be used to write data to a Numpy binary format file. After creation, call one of the WriteXX methods to write array data to the file. The file is automatically closed at the end of that call. Only one array can be written to a file.
func NewWriter ¶ added in v1.9.51
func NewWriter(w io.WriteCloser) (*NpyWriter, error)
NewWriter returns a NpyWriter that can be used to write data to an io.WriteCloser, using the Numpy binary format. After creation, call one of the WriteXXX methods to write array data to the writer. The file is automatically closed at the end of that call. Only one slice can be written to the writer.
func (*NpyWriter) WriteComplex128 ¶ added in v1.9.51
func (wtr *NpyWriter) WriteComplex128(data []complex128) error
WriteComplex128 writes a slice of complex128 values in npy format.
func (*NpyWriter) WriteComplex64 ¶ added in v1.9.51
WriteComplex64 writes a slice of complex64 values in npy format.
func (*NpyWriter) WriteFloat32 ¶ added in v1.9.51
WriteFloat32 writes a slice of float32 values in npy format.
func (*NpyWriter) WriteFloat64 ¶ added in v1.9.51
WriteFloat64 writes a slice of float64 values in npy format.
func (*NpyWriter) WriteInt16 ¶ added in v1.9.51
WriteInt16 writes a slice of int16 values in npy format.
func (*NpyWriter) WriteInt32 ¶ added in v1.9.51
WriteInt32 writes a slice of int32 values in npy format.
func (*NpyWriter) WriteInt64 ¶ added in v1.9.51
WriteInt64 writes a slice of int64 values in npy format.
func (*NpyWriter) WriteInt8 ¶ added in v1.9.51
WriteInt8 writes a slice of int8 values in npy format.
func (*NpyWriter) WriteUint16 ¶ added in v1.9.51
WriteUint16 writes a slice of uint16 values in npy format.
func (*NpyWriter) WriteUint32 ¶ added in v1.9.51
WriteUint32 writes a slice of uint32 values in npy format.
func (*NpyWriter) WriteUint64 ¶ added in v1.9.51
WriteUint64 writes a slice of uint64 values in npy format.
func (*NpyWriter) WriteUint8 ¶ added in v1.9.51
WriteUint8 writes a slice of uint8 values in npy format.