ms

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

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

func NewContext

func NewContext() *Context

func (*Context) AddDeviceInfo

func (ctx *Context) AddDeviceInfo(di *DeviceInfo)

func (*Context) Destroy

func (ctx *Context) Destroy()

func (*Context) GetEnableParallel

func (ctx *Context) GetEnableParallel() bool

func (*Context) GetThreadAffinityCoreList

func (ctx *Context) GetThreadAffinityCoreList() []int

func (*Context) GetThreadAffinityMode

func (ctx *Context) GetThreadAffinityMode() ThreadAffinityMode

func (*Context) GetThreadNum

func (ctx *Context) GetThreadNum() int

func (*Context) SetEnableParallel

func (ctx *Context) SetEnableParallel(enable bool)

func (*Context) SetThreadAffinityCoreList

func (ctx *Context) SetThreadAffinityCoreList(list []int)

func (*Context) SetThreadAffinityMode

func (ctx *Context) SetThreadAffinityMode(mod ThreadAffinityMode)

func (*Context) SetThreadNum

func (ctx *Context) SetThreadNum(num int)

type DataType

type DataType C.MSDataType
const (
	DataTypeUnknown           DataType = C.kMSDataTypeUnknown
	DataTypeObjectTypeString  DataType = C.kMSDataTypeObjectTypeString
	DataTypeObjectTypeList    DataType = C.kMSDataTypeObjectTypeList
	DataTypeObjectTypeTuple   DataType = C.kMSDataTypeObjectTypeTuple
	DataTypeObjectTypeTensor  DataType = C.kMSDataTypeObjectTypeTensor
	DataTypeNumberTypeBegin   DataType = C.kMSDataTypeNumberTypeBegin
	DataTypeNumberTypeBool    DataType = C.kMSDataTypeNumberTypeBool
	DataTypeNumberTypeInt8    DataType = C.kMSDataTypeNumberTypeInt8
	DataTypeNumberTypeInt16   DataType = C.kMSDataTypeNumberTypeInt16
	DataTypeNumberTypeInt32   DataType = C.kMSDataTypeNumberTypeInt32
	DataTypeNumberTypeInt64   DataType = C.kMSDataTypeNumberTypeInt64
	DataTypeNumberTypeUInt8   DataType = C.kMSDataTypeNumberTypeUInt8
	DataTypeNumberTypeUInt16  DataType = C.kMSDataTypeNumberTypeUInt16
	DataTypeNumberTypeUInt32  DataType = C.kMSDataTypeNumberTypeUInt32
	DataTypeNumberTypeUInt64  DataType = C.kMSDataTypeNumberTypeUInt64
	DataTypeNumberTypeFloat16 DataType = C.kMSDataTypeNumberTypeFloat16
	DataTypeNumberTypeFloat32 DataType = C.kMSDataTypeNumberTypeFloat32
	DataTypeNumberTypeFloat64 DataType = C.kMSDataTypeNumberTypeFloat64
	DataTypeNumberTypeEnd     DataType = C.kMSDataTypeNumberTypeEnd
	DataTypeInvalid           DataType = C.kMSDataTypeInvalid
)

type DeviceInfo

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

func NewDeviceInfo

func NewDeviceInfo(typ DeviceType) *DeviceInfo

func (*DeviceInfo) Destroy

func (di *DeviceInfo) Destroy()

func (*DeviceInfo) GetDeviceType

func (di *DeviceInfo) GetDeviceType() DeviceType

func (*DeviceInfo) GetEnableFP16

func (di *DeviceInfo) GetEnableFP16() bool

func (*DeviceInfo) GetFrequency

func (di *DeviceInfo) GetFrequency(frequency int) int

func (*DeviceInfo) GetProvider

func (di *DeviceInfo) GetProvider() string

func (*DeviceInfo) GetProviderDevice

func (di *DeviceInfo) GetProviderDevice() string

func (*DeviceInfo) SetEnableFP16

func (di *DeviceInfo) SetEnableFP16(enable bool)

func (*DeviceInfo) SetFrequency

func (di *DeviceInfo) SetFrequency(frequency int)

func (*DeviceInfo) SetProvider

func (di *DeviceInfo) SetProvider(provider string)

func (*DeviceInfo) SetProviderDevice

func (di *DeviceInfo) SetProviderDevice(device string)

type DeviceType

type DeviceType C.MSDeviceType
const (
	DeviceTypeCPU      DeviceType = C.kMSDeviceTypeCPU
	DeviceTypeGPU      DeviceType = C.kMSDeviceTypeGPU
	DeviceTypeKirinNPU DeviceType = C.kMSDeviceTypeKirinNPU
	DeviceTypeInvalid  DeviceType = C.kMSDeviceTypeInvalid
)

type Format

type Format C.MSFormat
const (
	FormatNCHW   Format = C.kMSFormatNCHW
	FormatNHWC   Format = C.kMSFormatNHWC
	FormatNHWC4  Format = C.kMSFormatNHWC4
	FormatHWKC   Format = C.kMSFormatHWKC
	FormatHWCK   Format = C.kMSFormatHWCK
	FormatKCHW   Format = C.kMSFormatKCHW
	FormatCKHW   Format = C.kMSFormatCKHW
	FormatKHWC   Format = C.kMSFormatKHWC
	FormatCHWK   Format = C.kMSFormatCHWK
	FormatHW     Format = C.kMSFormatHW
	FormatHW4    Format = C.kMSFormatHW4
	FormatNC     Format = C.kMSFormatNC
	FormatNC4    Format = C.kMSFormatNC4
	FormatNC4HW4 Format = C.kMSFormatNC4HW4
	FormatNCDHW  Format = C.kMSFormatNCDHW
	FormatNWC    Format = C.kMSFormatNWC
	FormatNCW    Format = C.kMSFormatNCW
)

type Model

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

func NewModel

func NewModel() *Model

func (*Model) Build

func (mod *Model) Build(modData []byte, modType ModelType, ctx *Context) error

func (*Model) BuildFromFile

func (mod *Model) BuildFromFile(file string, modType ModelType, ctx *Context) error

func (*Model) Destroy

func (mod *Model) Destroy()

func (*Model) GetInputByTensorName

func (mod *Model) GetInputByTensorName(name string) *Tensor

func (*Model) GetInputs

func (mod *Model) GetInputs() []*Tensor

func (*Model) GetOutputByTensorName

func (mod *Model) GetOutputByTensorName(name string) *Tensor

func (*Model) GetOutputs

func (mod *Model) GetOutputs() []*Tensor

func (*Model) Predict

func (mod *Model) Predict(input []*Tensor) []*Tensor

func (*Model) Resize

func (mod *Model) Resize(tensors []*Tensor, shapes [][]int)

type ModelType

type ModelType C.MSModelType
const (
	ModelTypeMindIR  ModelType = C.kMSModelTypeMindIR
	ModelTypeInvalid ModelType = C.kMSModelTypeInvalid
)

type Tensor

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

func NewTensor

func NewTensor(name string, dtyp DataType, shape []int, data interface{}) *Tensor

data must be pointer,like &[]int{},&[]float{}

func (*Tensor) DeepClone

func (tensor *Tensor) DeepClone() *Tensor

func (*Tensor) Destroy

func (tensor *Tensor) Destroy()

func (*Tensor) GetData

func (tensor *Tensor) GetData() unsafe.Pointer

func (*Tensor) GetDataType

func (tensor *Tensor) GetDataType() DataType

func (*Tensor) GetElementNum

func (tensor *Tensor) GetElementNum() int

func (*Tensor) GetFormat

func (tensor *Tensor) GetFormat() Format

func (*Tensor) GetMutableData

func (tensor *Tensor) GetMutableData() unsafe.Pointer

func (*Tensor) GetName

func (tensor *Tensor) GetName() string

func (*Tensor) GetShape

func (tensor *Tensor) GetShape() []int

func (*Tensor) SetData

func (tensor *Tensor) SetData(data interface{})

func (*Tensor) SetDataType

func (tensor *Tensor) SetDataType(dtyp DataType)

func (*Tensor) SetFormat

func (tensor *Tensor) SetFormat(fmt Format)

func (*Tensor) SetName

func (tensor *Tensor) SetName(name string)

func (*Tensor) SetShape

func (tensor *Tensor) SetShape(shape ...int)

type TensorArray

type TensorArray C.MSTensorHandleArray

func Tensors2TensorArray

func Tensors2TensorArray(tensors []*Tensor) *TensorArray

func (TensorArray) ToTensors

func (ta TensorArray) ToTensors() []*Tensor

type ThreadAffinityMode

type ThreadAffinityMode C.int
const (
	ThreadAffinityModeNoAffinities     ThreadAffinityMode = 0
	ThreadAffinityModeBigCoresFirst    ThreadAffinityMode = 1
	ThreadAffinityModeLittleCoresFirst ThreadAffinityMode = 2
)

type TypeSize

type TypeSize uint64
const (
	TypeSizePtr TypeSize = 8
	TypeSize8   TypeSize = 1
	TypeSize16  TypeSize = 2
	TypeSize32  TypeSize = 4
	TypeSize64  TypeSize = 8
)

Jump to

Keyboard shortcuts

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