Documentation ¶
Overview ¶
Package dense provides methods for Gorgonia's Dense Tensors.
Index ¶
- Constants
- func AMax(d *tensor.Dense, axis int) (interface{}, error)
- func AMaxF32(d *tensor.Dense, axis int) (float32, error)
- func BroadcastAdd(a, b *tensor.Dense) (retVal *tensor.Dense, err error)
- func BroadcastDiv(a, b *tensor.Dense) (retVal *tensor.Dense, err error)
- func BroadcastMul(a, b *tensor.Dense) (retVal *tensor.Dense, err error)
- func BroadcastSub(a, b *tensor.Dense) (retVal *tensor.Dense, err error)
- func Concat(axis int, tensors ...*t.Dense) (retVal *t.Dense, err error)
- func ConcatOr(axis int, a, b *t.Dense) (retVal *t.Dense, err error)
- func Contains(d *t.Dense, val interface{}) (contains bool, indicies []int)
- func Div(a, b *t.Dense) (*t.Dense, error)
- func ExpandDims(t *tensor.Dense, axis int) error
- func ExpandDimsShape(shape tensor.Shape, axis int) tensor.Shape
- func FauxZeroValue(dt t.Dtype) interface{}
- func Fill(val interface{}, shape ...int) *t.Dense
- func ManyOfOne(t *tensor.Dense) error
- func Mean(x *t.Dense, along ...int) (*t.Dense, error)
- func MinMaxNorm(x, min, max *t.Dense) (*t.Dense, error)
- func MulShape(shape tensor.Shape, by int) tensor.Shape
- func Neg(v *tensor.Dense) (*t.Dense, error)
- func NegValue(dt t.Dtype) interface{}
- func NormalizeZeros(d *t.Dense) error
- func OneHotVector(id, classes int, dt t.Dtype) (retVal *t.Dense, err error)
- func OneOfMany(t *tensor.Dense) error
- func RandN(dt t.Dtype, shape ...int) *t.Dense
- func Repeat(t *tensor.Dense, axis int, repeats ...int) (*tensor.Dense, error)
- func SizeAsDType(x *tensor.Dense, along ...int) (size *tensor.Dense, err error)
- func Squeeze(t *tensor.Dense) error
- func SqueezeShape(shape tensor.Shape) tensor.Shape
- func StdDev(x *t.Dense, along ...int) (*t.Dense, error)
- func ToF32(t *tensor.Dense) (*tensor.Dense, error)
- func ZNorm(x *t.Dense, along ...int) (*t.Dense, error)
- func ZeroValue(dt t.Dtype) interface{}
- func Zeros(dt t.Dtype, shape ...int) *t.Dense
- type EqWidthBinner
- type RangedSlice
- type SingleSlice
Constants ¶
const FauxZero = 1e-6
FauxZero is the faux zero value used to prevent divde by zero errors.
Variables ¶
This section is empty.
Functions ¶
func AMax ¶
AMax returns the maximum value in a tensor along an axis. TODO: support returning slice.
func BroadcastAdd ¶
BroadcastAdd adds 'a' to 'b' element-wise using broadcasting rules.
Shapes are compared element-wise starting with trailing dimensions and working its way forward. Dimensions are compatible if: - they are equal - one of them is 1
func BroadcastDiv ¶
BroadcastDiv safely divides 'a' to 'b' element-wise using broadcasting rules. Any zero values in 'b' will be slightly augmented.
Shapes are compared element-wise starting with trailing dimensions and working its way forward. Dimensions are compatible if: - they are equal - one of them is 1
func BroadcastMul ¶
BroadcastMul multiplies 'a' to 'b' element-wise using broadcasting rules.
Shapes are compared element-wise starting with trailing dimensions and working its way forward. Dimensions are compatible if: - they are equal - one of them is 1
func BroadcastSub ¶
BroadcastSub subtracts 'a' from 'b' element-wise using broadcasting rules.
Shapes are compared element-wise starting with trailing dimensions and working its way forward. Dimensions are compatible if: - they are equal - one of them is 1
func ExpandDims ¶
ExpandDims expands the dimensions of a tensor along the given axis.
func ExpandDimsShape ¶
ExpandDimsShape expands the dimensions of a shape along the given axis.
func FauxZeroValue ¶
FauxZeroValue is a faux zero value for the given datatype.
func MinMaxNorm ¶
MinMaxNorm normalizes the input x using pointwise min-max normalization along the axis. This is a pointwise operation and requires the shape of the min/max tensors be equal to x.
y=(x-min)/(max-min)
func NormalizeZeros ¶
NormalizeZeros normalizes the zero values.
func OneHotVector ¶
OneHotVector creates a one hot vector for the given id within the number of classses.
Note: this is mostly taken from gorgonia core, but was needed as a basic tensor function, should be contributed back upstream.
func RandN ¶
RandN generates a new dense tensor of the given shape with values populated from the standard normal distribution.
func SizeAsDType ¶
SizeAsDType returns the size of a tensor as a tensor along the axis with the same dtype.
func SqueezeShape ¶
SqueezeShape removes any dimensions of size 1.
Types ¶
type EqWidthBinner ¶
type EqWidthBinner struct { // Intervals to bin. Intervals *tensor.Dense // Low values are the lower bounds. Low *tensor.Dense // High values are the upper bounds. High *tensor.Dense // contains filtered or unexported fields }
EqWidthBinner bins values within diminsions to the given intervals.
func NewEqWidthBinner ¶
func NewEqWidthBinner(intervals, low, high *tensor.Dense) (*EqWidthBinner, error)
NewEqWidthBinner creates a new Equal Width Binner.
func (*EqWidthBinner) Bounds ¶
func (d *EqWidthBinner) Bounds() []*tensor.Dense
Bounds used in binning.
func (*EqWidthBinner) Widths ¶
func (d *EqWidthBinner) Widths() *tensor.Dense
Widths used in binning.
type RangedSlice ¶
type RangedSlice struct {
// contains filtered or unexported fields
}
RangedSlice is a ranged slice that implements the Slice interface.
func MakeRangedSlice ¶
func MakeRangedSlice(start, end int, opts ...int) RangedSlice
MakeRangedSlice creates a ranged slice. It takes an optional step param.
type SingleSlice ¶
type SingleSlice int
SingleSlice is a single slice, representing this: [start:start+1:0]