paddle

package module
v0.0.0-...-cc06156 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: MIT Imports: 9 Imported by: 3 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

paddle

Go Reference

Go Inference Engine for PaddlePaddle.

Installation

  1. Install paddle

    $ go get -u github.com/go-aie/paddle
    
  2. Install Paddle Inference Go API

Documentation

Check out the documentation.

Known Issues

BLAS error

When using a high maxConcurrency (e.g. running benchmarks), sometimes you will get a BLAS error:

BLAS : Program is Terminated. Because you tried to allocate too many memory regions.
Solution

Set OpenBLAS to use a single thread:

export OPENBLAS_NUM_THREADS=1
export GOTO_NUM_THREADS=1
export OMP_NUM_THREADS=1

See also:

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine is an inference engine.

func NewEngine

func NewEngine(model, params string, maxConcurrency int) *Engine

func (*Engine) Infer

func (e *Engine) Infer(inputs []Tensor) (outputs []Tensor)

type Matrix

type Matrix[E xslices.Number] struct {
	// contains filtered or unexported fields
}

func NewMatrix

func NewMatrix[E xslices.Number](r, c int, data []E) *Matrix[E]

func NewMatrixFromTensor

func NewMatrixFromTensor[E xslices.Number](t Tensor) *Matrix[E]

func (*Matrix[E]) Col

func (m *Matrix[E]) Col(j int) []E

func (*Matrix[E]) Cols

func (m *Matrix[E]) Cols() [][]E

func (*Matrix[E]) Dims

func (m *Matrix[E]) Dims() (r, c int)

func (*Matrix[E]) Equal

func (m *Matrix[E]) Equal(other *Matrix[E]) bool

Equal implements the Equal method which will be used by go-cmp to determine equality.

func (*Matrix[E]) Norm

func (m *Matrix[E]) Norm() *Matrix[E]

func (*Matrix[E]) Pad

func (m *Matrix[E]) Pad(r, c int, v E) *Matrix[E]

Pad creates a new matrix, which expands the receiver m by r rows and c columns, and sets each expanded element to v.

func (*Matrix[E]) RawData

func (m *Matrix[E]) RawData() []E

func (*Matrix[E]) Row

func (m *Matrix[E]) Row(i int) []E

func (*Matrix[E]) Rows

func (m *Matrix[E]) Rows() [][]E

func (*Matrix[E]) Set

func (m *Matrix[E]) Set(rowStart, rowEnd, colStart, colEnd int, value E) *Matrix[E]

func (*Matrix[E]) SetAll

func (m *Matrix[E]) SetAll(value E) *Matrix[E]

func (*Matrix[E]) SetAllFunc

func (m *Matrix[E]) SetAllFunc(f func(E) E) *Matrix[E]

func (*Matrix[E]) SetFunc

func (m *Matrix[E]) SetFunc(rowStart, rowEnd, colStart, colEnd int, f func(E) E) *Matrix[E]

type PredictorPool

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

PredictorPool is a predictor pool for concurrent inferences.

See also: - https://github.com/PaddlePaddle/Paddle/issues/17288 - https://www.paddlepaddle.org.cn/inference/master/guides/performance_tuning/multi_thread.html

func NewPredictorPool

func NewPredictorPool(config *paddle.Config, size int) *PredictorPool

func (*PredictorPool) Get

func (p *PredictorPool) Get() (predictor *paddle.Predictor, put func())

type Tensor

type Tensor struct {
	Shape []int32
	Data  interface{}
}

func NewTensorFromFourDimSlice

func NewTensorFromFourDimSlice[E any](slice [][][][]E) Tensor

func NewTensorFromOneDimSlice

func NewTensorFromOneDimSlice[E any](slice []E) Tensor

func NewTensorFromThreeDimSlice

func NewTensorFromThreeDimSlice[E any](slice [][][]E) Tensor

func NewTensorFromTwoDimSlice

func NewTensorFromTwoDimSlice[E any](slice [][]E) Tensor

type TypedTensor

type TypedTensor[E xslices.Number] struct {
	Shape []int32
	Data  []E
}

func NewTypedTensor

func NewTypedTensor[E xslices.Number](t Tensor) TypedTensor[E]

Directories

Path Synopsis
cmd
paddle module

Jump to

Keyboard shortcuts

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