redisai

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2019 License: BSD-3-Clause Imports: 10 Imported by: 11

Documentation

Index

Constants

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

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

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

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

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

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

Variables

View Source
var ErrNil = errors.New("redisai-go: nil returned")

Functions

func Float32s

func Float32s(reply interface{}, err error) ([]float32, error)

Float32s is a helper that converts an array command reply to a []float32.

func Int16s

func Int16s(reply interface{}, err error) ([]int16, error)

Int16s is a helper that converts an array command reply to a []int16.

func Int8s

func Int8s(reply interface{}, err error) ([]int8, error)

Int8s is a helper that converts an array command reply to a []int8.

func ModelRunArgs

func ModelRunArgs(name string, inputs []string, outputs []string, includeCommandName bool) redis.Args

func ProcessTensorReplyBlob

func ProcessTensorReplyBlob(resp []interface{}, err error) ([]interface{}, error)

func ProcessTensorReplyMeta

func ProcessTensorReplyMeta(resp interface{}, err error) (data []interface{}, outErr error)

func ProcessTensorReplyValues

func ProcessTensorReplyValues(resp []interface{}, err error) ([]interface{}, error)

func TensorSetArgs

func TensorSetArgs(name string, dt DataType, dims []int, data interface{}, includeCommandName bool) (redis.Args, error)

func Uint16s

func Uint16s(reply interface{}, err error) ([]uint16, error)

Uint16s is a helper that converts an array command reply to a []uint16.

func Uint8s

func Uint8s(reply interface{}, err error) ([]uint8, error)

Uint8s is a helper that converts an array command reply to a []uint8.

Types

type BackendType

type BackendType string

BackendType is a backend type

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) Flush

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

func (*Client) LoadBackend

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

func (*Client) ModelDel

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

func (*Client) ModelGet

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

func (*Client) ModelRun

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

ModelRun runs a RedisAI model

func (*Client) ModelSet

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

ModelSet sets a RedisAI model from a blob

func (*Client) ModelSetFromFile

func (c *Client) ModelSetFromFile(name string, backend BackendType, device DeviceType, path string, inputs []string, outputs []string) (err error)

ModelSetFromFile sets a RedisAI model from a file

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) ScriptDel

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

func (*Client) ScriptGet

func (c *Client) ScriptGet(name string) (data []interface{}, 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 DeviceType, script_source string) (err error)

ScriptSet sets a RedisAI script from a blob

func (*Client) ScriptSetFromFile

func (c *Client) ScriptSetFromFile(name string, device DeviceType, path string) error

ScriptSetFromFile sets a RedisAI script from a file

func (*Client) SendAndIncr

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

func (*Client) TensorGet

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

func (*Client) TensorGetBlob

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

TensorGetValues gets a tensor's values

func (*Client) TensorGetMeta

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

TensorGetValues gets a tensor's values

func (*Client) TensorGetValues

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

TensorGetValues gets a tensor's values

func (*Client) TensorSet

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

TensorSet sets a tensor

type DataType

type DataType string

DataType is a data type

type DeviceType

type DeviceType string

DeviceType is a device type

type TensorContentType

type TensorContentType string

TensorContentType is a tensor content type

Jump to

Keyboard shortcuts

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