Documentation ¶
Index ¶
- Variables
- type BuiltinOperator
- type DynamicBuffer
- type ExpRegistration
- type Interpreter
- func (i *Interpreter) AllocateTensors() Status
- func (i *Interpreter) Delete()
- func (i *Interpreter) GetInputTensor(index int) *Tensor
- func (i *Interpreter) GetInputTensorCount() int
- func (i *Interpreter) GetOutputTensor(index int) *Tensor
- func (i *Interpreter) GetOutputTensorCount() int
- func (i *Interpreter) Invoke() Status
- func (i *Interpreter) ResetVariableTensors() Status
- func (i *Interpreter) ResizeInputTensor(index int, dims []int32) Status
- type InterpreterOptions
- func (o *InterpreterOptions) AddDelegate(d delegates.Delegater)
- func (o *InterpreterOptions) Delete()
- func (o *InterpreterOptions) ExpAddBuiltinOp(op BuiltinOperator, reg *ExpRegistration, minVersion, maxVersion int)
- func (o *InterpreterOptions) ExpAddCustomOp(name string, reg *ExpRegistration, minVersion, maxVersion int)
- func (o *InterpreterOptions) SetErrorReporter(f func(string, interface{}), user_data interface{})
- func (o *InterpreterOptions) SetNumThread(num_threads int)
- func (o *InterpreterOptions) SetUseNNAPI(enable bool)
- type Model
- type QuantizationParams
- type Status
- type Tensor
- func (t *Tensor) ByteSize() uint
- func (t *Tensor) CopyFromBuffer(b interface{}) Status
- func (t *Tensor) CopyToBuffer(b interface{}) Status
- func (t *Tensor) Data() unsafe.Pointer
- func (t *Tensor) Dim(index int) int
- func (t *Tensor) Float32At(at ...int) float32
- func (t *Tensor) Float32s() []float32
- func (t *Tensor) GetString(index int) string
- func (t *Tensor) Int16s() []int16
- func (t *Tensor) Int32s() []int32
- func (t *Tensor) Int64s() []int64
- func (t *Tensor) Int8s() []int8
- func (t *Tensor) Name() string
- func (t *Tensor) NumDims() int
- func (t *Tensor) QuantizationParams() QuantizationParams
- func (t *Tensor) SetFloat32s(v []float32) error
- func (t *Tensor) SetInt16s(v []int16) error
- func (t *Tensor) SetInt32s(v []int32) error
- func (t *Tensor) SetInt64s(v []int64) error
- func (t *Tensor) SetInt8s(v []int8) error
- func (t *Tensor) SetUint8s(v []uint8) error
- func (t *Tensor) Shape() []int
- func (t *Tensor) String() string
- func (t *Tensor) Type() TensorType
- func (t *Tensor) UInt8s() []uint8
- type TensorType
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTypeMismatch is type mismatch. ErrTypeMismatch = errors.New("type mismatch") // ErrBadTensor is bad tensor. ErrBadTensor = errors.New("bad tensor") )
Functions ¶
This section is empty.
Types ¶
type BuiltinOperator ¶
type BuiltinOperator int
const ( BuiltinOperator_ADD BuiltinOperator = 0 BuiltinOperator_AVERAGE_POOL_2D BuiltinOperator = 1 BuiltinOperator_CONCATENATION BuiltinOperator = 2 BuiltinOperator_CONV_2D BuiltinOperator = 3 BuiltinOperator_DEPTHWISE_CONV_2D BuiltinOperator = 4 BuiltinOperator_DEQUANTIZE BuiltinOperator = 6 BuiltinOperator_EMBEDDING_LOOKUP BuiltinOperator = 7 BuiltinOperator_FLOOR BuiltinOperator = 8 BuiltinOperator_FULLY_CONNECTED BuiltinOperator = 9 BuiltinOperator_HASHTABLE_LOOKUP BuiltinOperator = 10 BuiltinOperator_L2_NORMALIZATION BuiltinOperator = 11 BuiltinOperator_L2_POOL_2D BuiltinOperator = 12 BuiltinOperator_LOCAL_RESPONSE_NORMALIZATION BuiltinOperator = 13 BuiltinOperator_LOGISTIC BuiltinOperator = 14 BuiltinOperator_LSH_PROJECTION BuiltinOperator = 15 BuiltinOperator_LSTM BuiltinOperator = 16 BuiltinOperator_MAX_POOL_2D BuiltinOperator = 17 BuiltinOperator_MUL BuiltinOperator = 18 BuiltinOperator_RELU BuiltinOperator = 19 BuiltinOperator_RELU_N1_TO_1 BuiltinOperator = 20 BuiltinOperator_RELU6 BuiltinOperator = 21 BuiltinOperator_RESHAPE BuiltinOperator = 22 BuiltinOperator_RESIZE_BILINEAR BuiltinOperator = 23 BuiltinOperator_RNN BuiltinOperator = 24 BuiltinOperator_SOFTMAX BuiltinOperator = 25 BuiltinOperator_SPACE_TO_DEPTH BuiltinOperator = 26 BuiltinOperator_SVDF BuiltinOperator = 27 BuiltinOperator_TANH BuiltinOperator = 28 BuiltinOperator_CONCAT_EMBEDDINGS BuiltinOperator = 29 BuiltinOperator_SKIP_GRAM BuiltinOperator = 30 BuiltinOperator_CALL BuiltinOperator = 31 BuiltinOperator_CUSTOM BuiltinOperator = 32 BuiltinOperator_EMBEDDING_LOOKUP_SPARSE BuiltinOperator = 33 BuiltinOperator_PAD BuiltinOperator = 34 BuiltinOperator_UNIDIRECTIONAL_SEQUENCE_RNN BuiltinOperator = 35 BuiltinOperator_GATHER BuiltinOperator = 36 BuiltinOperator_BATCH_TO_SPACE_ND BuiltinOperator = 37 BuiltinOperator_SPACE_TO_BATCH_ND BuiltinOperator = 38 BuiltinOperator_TRANSPOSE BuiltinOperator = 39 BuiltinOperator_MEAN BuiltinOperator = 40 BuiltinOperator_SUB BuiltinOperator = 41 BuiltinOperator_DIV BuiltinOperator = 42 BuiltinOperator_SQUEEZE BuiltinOperator = 43 BuiltinOperator_UNIDIRECTIONAL_SEQUENCE_LSTM BuiltinOperator = 44 BuiltinOperator_STRIDED_SLICE BuiltinOperator = 45 BuiltinOperator_BIDIRECTIONAL_SEQUENCE_RNN BuiltinOperator = 46 BuiltinOperator_EXP BuiltinOperator = 47 BuiltinOperator_TOPK_V2 BuiltinOperator = 48 BuiltinOperator_SPLIT BuiltinOperator = 49 BuiltinOperator_LOG_SOFTMAX BuiltinOperator = 50 BuiltinOperator_DELEGATE BuiltinOperator = 51 BuiltinOperator_BIDIRECTIONAL_SEQUENCE_LSTM BuiltinOperator = 52 BuiltinOperator_CAST BuiltinOperator = 53 BuiltinOperator_PRELU BuiltinOperator = 54 BuiltinOperator_MAXIMUM BuiltinOperator = 55 BuiltinOperator_ARG_MAX BuiltinOperator = 56 BuiltinOperator_MINIMUM BuiltinOperator = 57 BuiltinOperator_LESS BuiltinOperator = 58 BuiltinOperator_NEG BuiltinOperator = 59 BuiltinOperator_PADV2 BuiltinOperator = 60 BuiltinOperator_GREATER BuiltinOperator = 61 BuiltinOperator_GREATER_EQUAL BuiltinOperator = 62 BuiltinOperator_LESS_EQUAL BuiltinOperator = 63 BuiltinOperator_SELECT BuiltinOperator = 64 BuiltinOperator_SLICE BuiltinOperator = 65 BuiltinOperator_SIN BuiltinOperator = 66 BuiltinOperator_TRANSPOSE_CONV BuiltinOperator = 67 BuiltinOperator_SPARSE_TO_DENSE BuiltinOperator = 68 BuiltinOperator_TILE BuiltinOperator = 69 BuiltinOperator_EXPAND_DIMS BuiltinOperator = 70 BuiltinOperator_EQUAL BuiltinOperator = 71 BuiltinOperator_NOT_EQUAL BuiltinOperator = 72 BuiltinOperator_LOG BuiltinOperator = 73 BuiltinOperator_SUM BuiltinOperator = 74 BuiltinOperator_SQRT BuiltinOperator = 75 BuiltinOperator_RSQRT BuiltinOperator = 76 BuiltinOperator_SHAPE BuiltinOperator = 77 BuiltinOperator_POW BuiltinOperator = 78 BuiltinOperator_ARG_MIN BuiltinOperator = 79 BuiltinOperator_FAKE_QUANT BuiltinOperator = 80 BuiltinOperator_REDUCE_PROD BuiltinOperator = 81 BuiltinOperator_REDUCE_MAX BuiltinOperator = 82 BuiltinOperator_PACK BuiltinOperator = 83 BuiltinOperator_LOGICAL_OR BuiltinOperator = 84 BuiltinOperator_ONE_HOT BuiltinOperator = 85 BuiltinOperator_LOGICAL_AND BuiltinOperator = 86 BuiltinOperator_LOGICAL_NOT BuiltinOperator = 87 BuiltinOperator_UNPACK BuiltinOperator = 88 BuiltinOperator_REDUCE_MIN BuiltinOperator = 89 BuiltinOperator_FLOOR_DIV BuiltinOperator = 90 BuiltinOperator_REDUCE_ANY BuiltinOperator = 91 BuiltinOperator_SQUARE BuiltinOperator = 92 BuiltinOperator_ZEROS_LIKE BuiltinOperator = 93 BuiltinOperator_FILL BuiltinOperator = 94 BuiltinOperator_FLOOR_MOD BuiltinOperator = 95 BuiltinOperator_RANGE BuiltinOperator = 96 BuiltinOperator_RESIZE_NEAREST_NEIGHBOR BuiltinOperator = 97 BuiltinOperator_LEAKY_RELU BuiltinOperator = 98 BuiltinOperator_SQUARED_DIFFERENCE BuiltinOperator = 99 BuiltinOperator_MIRROR_PAD BuiltinOperator = 100 BuiltinOperator_ABS BuiltinOperator = 101 BuiltinOperator_SPLIT_V BuiltinOperator = 102 BuiltinOperator_UNIQUE BuiltinOperator = 103 BuiltinOperator_CEIL BuiltinOperator = 104 BuiltinOperator_REVERSE_V2 BuiltinOperator = 105 BuiltinOperator_ADD_N BuiltinOperator = 106 BuiltinOperator_GATHER_ND BuiltinOperator = 107 BuiltinOperator_COS BuiltinOperator = 108 BuiltinOperator_WHERE BuiltinOperator = 109 BuiltinOperator_RANK BuiltinOperator = 110 BuiltinOperator_ELU BuiltinOperator = 111 BuiltinOperator_REVERSE_SEQUENCE BuiltinOperator = 112 BuiltinOperator_MATRIX_DIAG BuiltinOperator = 113 BuiltinOperator_QUANTIZE BuiltinOperator = 114 BuiltinOperator_MATRIX_SET_DIAG BuiltinOperator = 115 BuiltinOperator_MIN BuiltinOperator = BuiltinOperator_ADD BuiltinOperator_MAX BuiltinOperator = BuiltinOperator_MATRIX_SET_DIAG )
type DynamicBuffer ¶
type DynamicBuffer struct {
// contains filtered or unexported fields
}
DynamicBuffer is buffer hold multiple strings.
func (*DynamicBuffer) AddString ¶
func (d *DynamicBuffer) AddString(s string)
AddString append to the dynamic buffer.
func (*DynamicBuffer) WriteToTensorAsVector ¶
func (d *DynamicBuffer) WriteToTensorAsVector(t *Tensor)
WriteToTensorAsVector write buffer into the tensor as vector.
type ExpRegistration ¶
type ExpRegistration struct { Init unsafe.Pointer Free unsafe.Pointer Prepare unsafe.Pointer Invoke unsafe.Pointer ProfilingString unsafe.Pointer }
ExtRegistration indicate registration structure.
type Interpreter ¶
type Interpreter struct {
// contains filtered or unexported fields
}
Interpreter implement TfLiteInterpreter.
func NewInterpreter ¶
func NewInterpreter(model *Model, options *InterpreterOptions) *Interpreter
NewInterpreter create new Interpreter.
func (*Interpreter) AllocateTensors ¶
func (i *Interpreter) AllocateTensors() Status
AllocateTensor allocate tensors for the interpreter.
func (*Interpreter) GetInputTensor ¶
func (i *Interpreter) GetInputTensor(index int) *Tensor
GetInputTensor return input tensor specified by index.
func (*Interpreter) GetInputTensorCount ¶
func (i *Interpreter) GetInputTensorCount() int
GetInputTensorCount return number of input tensors.
func (*Interpreter) GetOutputTensor ¶
func (i *Interpreter) GetOutputTensor(index int) *Tensor
GetOutputTensor return output tensor specified by index.
func (*Interpreter) GetOutputTensorCount ¶
func (i *Interpreter) GetOutputTensorCount() int
GetOutputTensorCount return number of output tensors.
func (*Interpreter) ResetVariableTensors ¶
func (i *Interpreter) ResetVariableTensors() Status
ResetVariableTensors resets variable tensors.
func (*Interpreter) ResizeInputTensor ¶
func (i *Interpreter) ResizeInputTensor(index int, dims []int32) Status
ResizeInputTensor resize the tensor specified by index with dims.
type InterpreterOptions ¶
type InterpreterOptions struct {
// contains filtered or unexported fields
}
InterpreterOptions implement TfLiteInterpreterOptions.
func NewInterpreterOptions ¶
func NewInterpreterOptions() *InterpreterOptions
NewInterpreterOptions create new InterpreterOptions.
func (*InterpreterOptions) AddDelegate ¶
func (o *InterpreterOptions) AddDelegate(d delegates.Delegater)
func (*InterpreterOptions) Delete ¶
func (o *InterpreterOptions) Delete()
Delete delete instance of InterpreterOptions.
func (*InterpreterOptions) ExpAddBuiltinOp ¶
func (o *InterpreterOptions) ExpAddBuiltinOp(op BuiltinOperator, reg *ExpRegistration, minVersion, maxVersion int)
ExpAddBuiltinOp add builtin op specified by code and registration. Current implementation is work in progress.
func (*InterpreterOptions) ExpAddCustomOp ¶
func (o *InterpreterOptions) ExpAddCustomOp(name string, reg *ExpRegistration, minVersion, maxVersion int)
ExpAddCustomOp add custom op specified by name and registration. Current implementation is work in progress.
func (*InterpreterOptions) SetErrorReporter ¶
func (o *InterpreterOptions) SetErrorReporter(f func(string, interface{}), user_data interface{})
SetErrorRepoter set a function of reporter.
func (*InterpreterOptions) SetNumThread ¶
func (o *InterpreterOptions) SetNumThread(num_threads int)
SetNumThread set number of threads.
func (*InterpreterOptions) SetUseNNAPI ¶
func (o *InterpreterOptions) SetUseNNAPI(enable bool)
SetUseNNAPI enable or disable the NN API for the interpreter (true to enable).
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is TfLiteModel.
func NewModelFromFile ¶
NewModelFromFile create new Model from file data.
type QuantizationParams ¶
QuantizationParams implement TfLiteQuantizationParams.
type Tensor ¶
type Tensor struct {
// contains filtered or unexported fields
}
Tensor implement TfLiteTensor.
func (*Tensor) CopyFromBuffer ¶
CopyFromBuffer write buffer to the tensor.
func (*Tensor) CopyToBuffer ¶
CopyToBuffer write buffer from the tensor.
func (*Tensor) QuantizationParams ¶
func (t *Tensor) QuantizationParams() QuantizationParams
QuantizationParams return quantization parameters of the tensor.
func (*Tensor) SetFloat32s ¶
SetFloat32s sets float32s.
type TensorType ¶
type TensorType int
TensorType is types of the tensor.
const ( NoType TensorType = 0 Float32 TensorType = 1 Int32 TensorType = 2 UInt8 TensorType = 3 Int64 TensorType = 4 String TensorType = 5 Bool TensorType = 6 Int16 TensorType = 7 Complex64 TensorType = 8 Int8 TensorType = 9 )
func (TensorType) String ¶
func (i TensorType) String() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
_example
|
|
xor_embedded/statik
Package statik contains static assets.
|
Package statik contains static assets. |