blob

package
v0.0.0-...-533029d Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2017 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidShape indicates invalid shape array, i.e. a certern value is
	// less than or equal 0
	ErrInvalidShape = errors.New("invalid shape")
	// ErrExceedMaxAxes indicates exceed maximum axes error
	ErrExceedMaxAxes = errors.New("shape exceed maximum axes(32)")
)

Functions

This section is empty.

Types

type Blob

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

Blob is the basic data container in gocaffe

func FromProto

func FromProto(data *pb.BlobProto) (*Blob, error)

FromProto returns Blob reconstruct from protobuf data

func Init

func Init(shape []int64, v float64) (*Blob, error)

Init returns Blob with input shape, initialise with input value and type

func New

func New(shape []int64) (*Blob, error)

New returns Blob from input shape

func (*Blob) Add

func (b *Blob) Add(other *Blob) error

Add will add the data by a input blob

func (*Blob) AxesNum

func (b *Blob) AxesNum() int

AxesNum returns the length of blob shape

func (*Blob) Capacity

func (b *Blob) Capacity() int64

Capacity returns the capacity of blob

func (*Blob) Channels

func (b *Blob) Channels() int64

Channels returns channels of legacy shape

func (*Blob) Copy

func (b *Blob) Copy() *Blob

Copy returns a new blob with the same shape and data

func (*Blob) DataString

func (b *Blob) DataString() string

func (*Blob) Dot

func (b *Blob) Dot(other *Blob) (*Blob, error)

Dot performs element-wise multiply data by a input blob

func (*Blob) Exp

func (b *Blob) Exp()

Exp perform element-wise Exp function

func (*Blob) Get

func (b *Blob) Get(index []int) float64

Get returns the value in the input index based on the type

func (*Blob) GetCol

func (b *Blob) GetCol(index []int, x int) (*Blob, error)

GetCol returns a blob of shape 1x1x1xheight, used for MMul

func (*Blob) GetRow

func (b *Blob) GetRow(index []int, x int) (*Blob, error)

GetRow returns a blob of shape 1x1x1xwidth, used for MMul

func (*Blob) GetTop

func (b *Blob) GetTop(num int) []Value

GetTop returns tops number indexes and probs

func (*Blob) Height

func (b *Blob) Height() int64

Height returns height of legacy shape

func (*Blob) L1Norm

func (b *Blob) L1Norm() float64

L1Norm compute the sum of absolute values (L1 norm) of the data

func (*Blob) L2Norm

func (b *Blob) L2Norm() float64

L2Norm compute the sum of squares (L2 norm squared) of the data

func (*Blob) LegacyShape

func (b *Blob) LegacyShape(index int) int64

LegacyShape return index shape in the legacy

func (*Blob) MMul

func (b *Blob) MMul(x *Blob) (*Blob, error)

MMul performs matrix multiply

func (*Blob) Mul

func (b *Blob) Mul(other *Blob) (float64, error)

Mul perform matrix multiply data by a input blob

func (*Blob) Num

func (b *Blob) Num() int64

Num returns number of legacy shape

func (*Blob) Offset

func (b *Blob) Offset(indices []int) int

Offset returns data offset of input indices

func (*Blob) Powx

func (b *Blob) Powx(x float64)

Powx perform element-wise powx of the blob

func (*Blob) Range

func (b *Blob) Range(indices1, indices2 []int) (*Blob, error)

Range returns a new Blob between two input indices, currently used for convolution

func (*Blob) Reshape

func (b *Blob) Reshape(index []int64) (*Blob, error)

Reshape returns a blob of new shape

func (*Blob) Scale

func (b *Blob) Scale(scale float64)

Scale scale the blob data by a constant factor

func (*Blob) Set

func (b *Blob) Set(index []int, value float64)

Set will set value in the index with input type

func (*Blob) SetNumChannel

func (b *Blob) SetNumChannel(index0, index1 int, other *Blob) error

func (*Blob) Shape

func (b *Blob) Shape() []int64

Shape returns the shape of the blob

func (*Blob) ShapeEquals

func (b *Blob) ShapeEquals(other *Blob) bool

ShapeEquals returns whether two blob have the same shape

func (*Blob) ShapeOfIndex

func (b *Blob) ShapeOfIndex(index int) int64

ShapeOfIndex returns the shape in the input index

func (*Blob) Shift

func (b *Blob) Shift(shift float64)

Shift will shift the blob data by the input value

func (*Blob) String

func (b *Blob) String() string

Strings returns blob shape and capacity in string format

func (*Blob) Sub

func (b *Blob) Sub(other *Blob) *Blob

func (*Blob) ToProto

func (b *Blob) ToProto() ([]byte, error)

ToProto return protobuf binary data of Blob

func (*Blob) Trans

func (b *Blob) Trans() *Blob

Trans perform transpose of matrix

func (*Blob) Width

func (b *Blob) Width() int64

Width returns width of legacy shape

type SortValue

type SortValue []Value

func (SortValue) Len

func (v SortValue) Len() int

func (SortValue) Less

func (v SortValue) Less(i, j int) bool

func (SortValue) Swap

func (v SortValue) Swap(i, j int)

type Value

type Value struct {
	Index int
	Probs float64
}

Jump to

Keyboard shortcuts

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