redisai

package
v0.99.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: BSD-3-Clause Imports: 8 Imported by: 11

Documentation

Index

Constants

View Source
const (
	// BackendTF represents a TensorFlow backend
	BackendTF = string("TF")
	// BackendTorch represents a Torch backend
	BackendTorch = string("TORCH")
	// BackendONNX represents an ONNX backend
	BackendONNX = string("ORT")

	// DeviceCPU represents a CPU device
	DeviceCPU = string("CPU")
	// DeviceGPU represents a GPU device
	DeviceGPU = string("GPU")

	// TypeFloat represents a float type
	TypeFloat = string("FLOAT")
	// TypeDouble represents a double type
	TypeDouble = string("DOUBLE")
	// TypeInt8 represents a int8 type
	TypeInt8 = string("INT8")
	// TypeInt16 represents a int16 type
	TypeInt16 = string("INT16")
	// TypeInt32 represents a int32 type
	TypeInt32 = string("INT32")
	// TypeInt64 represents a int64 type
	TypeInt64 = string("INT64")
	// TypeUint8 represents a uint8 type
	TypeUint8 = string("UINT8")
	// TypeUint16 represents a uint16 type
	TypeUint16 = string("UINT16")
	// TypeFloat32 is an alias for float
	TypeFloat32 = string("FLOAT")
	// TypeFloat64 is an alias for double
	TypeFloat64 = string("DOUBLE")

	// TensorContentTypeBLOB is an alias for BLOB tensor content
	TensorContentTypeBlob = string("BLOB")

	// TensorContentTypeBLOB is an alias for BLOB tensor content
	TensorContentTypeValues = string("VALUES")

	// TensorContentTypeBLOB is an alias for BLOB tensor content
	TensorContentTypeMeta = string("META")
)

Variables

This section is empty.

Functions

func ProcessTensorGetReply added in v0.99.1

func ProcessTensorGetReply(reply interface{}, errIn error) (err error, dtype string, shape []int, data interface{})

func ProcessTensorReplyValues

func ProcessTensorReplyValues(dtype string, reply interface{}) (data interface{}, err error)

func TensorGetTypeStrFromType added in v0.99.1

func TensorGetTypeStrFromType(dtype reflect.Type) (typestr string, err error)

Types

type AiClient added in v0.99.1

type AiClient interface {
	// Close ensures that no connection is kept alive and prior to that we flush all db commands
	Close() error
	DoOrSend(string, redis.Args, error) (interface{}, error)
}

type Client

type Client struct {
	Pool                  *redis.Pool
	PipelineActive        bool
	PipelineAutoFlushSize uint32
	PipelinePos           uint32
	ActiveConn            redis.Conn
}

Client is a RedisAI client

func Connect

func Connect(url string, pool *redis.Pool) (c *Client)

Connect intializes a Client

func (*Client) ActiveConnNX

func (c *Client) ActiveConnNX()

func (*Client) Close

func (c *Client) Close() (err error)

Close ensures that no connection is kept alive and prior to that we flush all db commands

func (*Client) DisablePipeline

func (c *Client) DisablePipeline() (err error)

func (*Client) DoOrSend added in v0.99.1

func (c *Client) DoOrSend(cmdName string, args redis.Args, errIn error) (reply interface{}, err error)

func (*Client) Flush

func (c *Client) Flush() (err error)

func (*Client) Info added in v0.99.1

func (c *Client) Info(key string) (map[string]string, error)

Returns information about the execution a model or a script.

func (*Client) LoadBackend

func (c *Client) LoadBackend(backend_identifier string, location string) (err error)

func (*Client) ModelDel

func (c *Client) ModelDel(keyName string) (err error)

func (*Client) ModelGet

func (c *Client) ModelGet(keyName string) (data []interface{}, err error)

func (*Client) ModelGetToModel added in v0.99.1

func (c *Client) ModelGetToModel(keyName string, modelIn ModelInterface) (err error)

func (*Client) ModelRun

func (c *Client) ModelRun(name string, inputTensorNames, outputTensorNames []string) (err error)

ModelRun runs the model present in the keyName, with the input tensor names, and output tensor names

func (*Client) ModelSet

func (c *Client) ModelSet(keyName, backend, device string, data []byte, inputs, outputs []string) (err error)

ModelSet sets a RedisAI model from a blob

func (*Client) ModelSetFromModel added in v0.99.1

func (c *Client) ModelSetFromModel(keyName string, model ModelInterface) (err error)

ModelSet sets a RedisAI model from a structure that implements the ModelInterface

func (*Client) Pipeline

func (c *Client) Pipeline(PipelineAutoFlushAtSize uint32)

func (*Client) Receive

func (c *Client) Receive() (reply interface{}, err error)

Receive receives a single reply from the Redis server

func (*Client) ResetStat added in v0.99.1

func (c *Client) ResetStat(key string) (string, error)

Resets all statistics associated with the key

func (*Client) ScriptDel

func (c *Client) ScriptDel(name string) (err error)

func (*Client) ScriptGet

func (c *Client) ScriptGet(name string) (data map[string]string, err error)

func (*Client) ScriptRun

func (c *Client) ScriptRun(name string, fn string, inputs []string, outputs []string) (err error)

ScriptRun runs a RedisAI script

func (*Client) ScriptSet

func (c *Client) ScriptSet(name string, device string, script_source string) (err error)

ScriptSet sets a RedisAI script from a blob

func (*Client) SendAndIncr

func (c *Client) SendAndIncr(commandName string, args redis.Args) (err error)

func (*Client) TensorGet

func (c *Client) TensorGet(name, format string) (data []interface{}, err error)

func (*Client) TensorGetBlob

func (c *Client) TensorGetBlob(name string) (dt string, shape []int, data []byte, err error)

TensorGetValues gets a tensor's values

func (*Client) TensorGetMeta

func (c *Client) TensorGetMeta(name string) (dt string, shape []int, err error)

TensorGetValues gets a tensor's values

func (*Client) TensorGetToTensor added in v0.99.1

func (c *Client) TensorGetToTensor(name, format string, tensor TensorInterface) (err error)

func (*Client) TensorGetValues

func (c *Client) TensorGetValues(name string) (dt string, shape []int, data interface{}, err error)

TensorGetValues gets a tensor's values

func (*Client) TensorSet

func (c *Client) TensorSet(keyName, dt string, dims []int, data interface{}) (err error)

TensorSet sets a tensor

func (*Client) TensorSetFromTensor added in v0.99.1

func (c *Client) TensorSetFromTensor(keyName string, tensor TensorInterface) (err error)

TensorSet sets a tensor

type ModelInterface added in v0.99.1

type ModelInterface interface {
	Outputs() []string
	SetOutputs(outputs []string)
	Inputs() []string
	SetInputs(inputs []string)
	Blob() []byte
	SetBlob(blob []byte)
	Device() string
	SetDevice(device string)
	Backend() string
	SetBackend(backend string)
}

ModelInterface is an interface that represents the skeleton of a model needed to map it to a RedisAI Model with the proper operations

type TensorInterface added in v0.99.1

type TensorInterface interface {

	// Shape returns the size - in each dimension - of the tensor.
	Shape() []int

	SetShape(shape []int)

	// NumDims returns the number of dimensions of the tensor.
	NumDims() int

	// Len returns the number of elements in the tensor.
	Len() int

	Dtype() reflect.Type

	// Data returns the underlying tensor data
	Data() interface{}
	SetData(interface{})
}

TensorInterface is an interface that represents the skeleton of a tensor ( n-dimensional array of numerical data ) needed to map it to a RedisAI Model with the proper operations

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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