Documentation
¶
Index ¶
- func EnableTensorTrace()
- func EndTensorTrace()
- func SetDefaultDevice(device Device)
- func ShapeEqual(shape1, shape2 []int) bool
- func ShapeSum(shape []int) (result int)
- type CpuMemoryDevice
- type DataTrace
- type Device
- type DeviceNum
- type DeviceType
- type MemoryPool
- type Tensor
- func Add(a, b *Tensor) *Tensor
- func Copy(t *Tensor) *Tensor
- func HadamardProduct(a, b *Tensor) *Tensor
- func Identity() *Tensor
- func LoadFromCSV(filename string) (*Tensor, error)
- func LoadTensorFromGobFile(filename string) (*Tensor, error)
- func LookAt(eye, center, up *Tensor) *Tensor
- func Multiply(a, b *Tensor) *Tensor
- func NewEmptyTensor() *Tensor
- func NewRandomTensor(shape []int) *Tensor
- func NewTensor(data []float32, shape []int) *Tensor
- func NewTensorFromSlice(data [][]float32) *Tensor
- func NewTensorWithShape(shape []int) *Tensor
- func NewVec3(x, y, z float32) *Tensor
- func Ones(shape []int) *Tensor
- func Perspective(fovy, aspect, near, far float32) *Tensor
- func Random(shape []int, min, max float32) *Tensor
- func RandomNormal(shape []int) *Tensor
- func Rotate(axis *Tensor, angle float32) *Tensor
- func RotateTensor(axis *Tensor, angle float32) *Tensor
- func StackTensors(tensors []*Tensor, dim int) (*Tensor, error)
- func Subtract(a, b *Tensor) *Tensor
- func TranslateMatrix(v *Tensor) *Tensor
- func Transpose(t *Tensor, dims ...int) *Tensor
- func Viewport(x, y, w, h float32) *Tensor
- func Zeros(shape []int) *Tensor
- func ZerosLike(t *Tensor) *Tensor
- func (t *Tensor) Add(other *Tensor) *Tensor
- func (t *Tensor) AddScalar(scalar float32) *Tensor
- func (t *Tensor) Add_bak(other *Tensor) *Tensor
- func (t *Tensor) And(other *Tensor) *Tensor
- func (t *Tensor) Apply(fn func(float32) float32) *Tensor
- func (t *Tensor) Apply1(f func(float32) float32) *Tensor
- func (t *Tensor) ArgMax() *Tensor
- func (t *Tensor) At(indices ...int) float32
- func (t *Tensor) Backward()
- func (t *Tensor) BakTranspose() *Tensor
- func (t *Tensor) Clamp(min, max float32) *Tensor
- func (t *Tensor) Clone() *Tensor
- func (t *Tensor) Clone1() *Tensor
- func (t *Tensor) Concat(other *Tensor, dim int) *Tensor
- func (t *Tensor) Contain(other *Tensor) bool
- func (t *Tensor) ContainPanic() bool
- func (t *Tensor) Conv2D(weights *Tensor, kernelSize, stride, padH, padW int) *Tensor
- func (t *Tensor) Conv2DGradientWeight(input *Tensor, kernelH, kernelW, strideH, strideW, padH, padW int) *Tensor
- func (t *Tensor) Conv2DTranspose(weight *Tensor, kernelH, kernelW, strideH, strideW, padH, padW int) *Tensor
- func (t *Tensor) Copy() *Tensor
- func (t *Tensor) Crop(padding int) *Tensor
- func (t *Tensor) Cross(other *Tensor) *Tensor
- func (t *Tensor) Determinant() float32
- func (t *Tensor) DimSize(dim int) int
- func (t *Tensor) Dimensions() int
- func (t *Tensor) Div(other *Tensor) *Tensor
- func (t *Tensor) Div1(other *Tensor) *Tensor
- func (t *Tensor) DivScalar(scalar float32) *Tensor
- func (t *Tensor) Div_bak(other *Tensor) *Tensor
- func (t *Tensor) Dot(other *Tensor) float32
- func (t *Tensor) EnableGrad() *Tensor
- func (t *Tensor) Equal(other *Tensor) bool
- func (t *Tensor) EqualFloat16(other *Tensor) bool
- func (t *Tensor) EqualFloat32(other *Tensor) bool
- func (t *Tensor) EqualFloat32WithShape(other *Tensor) bool
- func (t *Tensor) EqualFloat5(other *Tensor) bool
- func (t *Tensor) EqualWithTolerance(other *Tensor, epsilon float32) bool
- func (t *Tensor) Exp() *Tensor
- func (t *Tensor) Expand(targetShape []int) *Tensor
- func (t *Tensor) Fill(value float32)
- func (t *Tensor) Flatten() *Tensor
- func (t *Tensor) FlattenByDim(startDim, endDim int) *Tensor
- func (t *Tensor) Gather(indices *Tensor) *Tensor
- func (t *Tensor) Get(indices []int) float32
- func (t *Tensor) GetCol(colIdx int) *Tensor
- func (t *Tensor) GetCols(start, end int) *Tensor
- func (t *Tensor) GetRow(row int) *Tensor
- func (t *Tensor) GetSample(batchIdx int) *Tensor
- func (t *Tensor) GetShape() []int
- func (t *Tensor) GetShapeByNum(num int) int
- func (t *Tensor) GetValue(indices []int) float32
- func (t *Tensor) Homogeneous() *Tensor
- func (t *Tensor) Indices(i int) []int
- func (t *Tensor) Inverse() *Tensor
- func (t *Tensor) IsMatrix() bool
- func (t *Tensor) IsVector() bool
- func (t *Tensor) Log() *Tensor
- func (pred *Tensor) LossMSE(target *Tensor) *Tensor
- func (t *Tensor) MaskedFill(mask *Tensor, value float32) *Tensor
- func (t *Tensor) MatMul(other *Tensor) *Tensor
- func (a *Tensor) MatMulMatrix(b *Tensor) *Tensor
- func (t *Tensor) Match() bool
- func (t *Tensor) MatchPanic() bool
- func (t *Tensor) Max() float32
- func (t *Tensor) Max1() float32
- func (t *Tensor) MaxByDim(dim int, keepdim bool) *Tensor
- func (t *Tensor) MaxPool(poolSize, stride int) (*Tensor, *Tensor)
- func (t *Tensor) Mean() float32
- func (t *Tensor) MeanTensor() *Tensor
- func (t *Tensor) Min() float32
- func (t *Tensor) Mul(other *Tensor) *Tensor
- func (m *Tensor) MulPosition(v *Tensor) *Tensor
- func (t *Tensor) MulScalar(scalar float32) *Tensor
- func (t *Tensor) Mul_bak(other *Tensor) *Tensor
- func (t *Tensor) Multiply(other *Tensor) *Tensor
- func (t *Tensor) Multiply1(other *Tensor) *Tensor
- func (t *Tensor) Negate() *Tensor
- func (t *Tensor) Normalize() *Tensor
- func (t *Tensor) Not() *Tensor
- func (t *Tensor) Or(other *Tensor) *Tensor
- func (t *Tensor) Pad(padding int) *Tensor
- func (t *Tensor) Pad2D(padH, padW int) *Tensor
- func (t *Tensor) Permute(perm []int) *Tensor
- func (t *Tensor) Pow(exponent float32) *Tensor
- func (t *Tensor) ReLU() *Tensor
- func (t *Tensor) Reciprocal() *Tensor
- func (t *Tensor) ReduceSum() *Tensor
- func (t *Tensor) Repeat(dim int, repeats int) *Tensor
- func (t *Tensor) RepeatInterleave(dim int, repeats int) *Tensor
- func (t *Tensor) RequireGrad() bool
- func (t *Tensor) Reshape(shape []int) *Tensor
- func (a *Tensor) Rotate(axis *Tensor, angle float32) *Tensor
- func (t *Tensor) RoundTo(decimals int) *Tensor
- func (t *Tensor) Save(filename string) error
- func (t *Tensor) SaveToCSV(filename string) error
- func (t *Tensor) SaveToCSVWithoutShape(filename string) error
- func (t *Tensor) ScatterAdd(indices *Tensor, source *Tensor)
- func (t *Tensor) Set(value float32, indices ...int)
- func (t *Tensor) Set1(indices []int, value float32)
- func (t *Tensor) SetCol(colIdx int, data *Tensor)
- func (m *Tensor) ShapeCopy() []int
- func (t *Tensor) ShapesMatch(other *Tensor) bool
- func (t *Tensor) Sigmoid() *Tensor
- func (t *Tensor) Size() int
- func (t *Tensor) Slice(start, end, dim int) *Tensor
- func (t *Tensor) Softmax() *Tensor
- func (t *Tensor) SoftmaxByDim(dim int) *Tensor
- func (t *Tensor) SplitLastDim(splitPoint, part int) *Tensor
- func (t *Tensor) Sqrt() *Tensor
- func (t *Tensor) Squeeze() *Tensor
- func (t *Tensor) SqueezeSpecific(dims []int) *Tensor
- func (t *Tensor) String() string
- func (t *Tensor) Sub(other *Tensor) *Tensor
- func (t *Tensor) Sub1(other *Tensor) *Tensor
- func (t *Tensor) SubScalar(scalar float32) *Tensor
- func (t *Tensor) Sub_bak(other *Tensor) *Tensor
- func (t *Tensor) Sum() float32
- func (t *Tensor) Sum1() float32
- func (t *Tensor) Sum111() *Tensor
- func (t *Tensor) SumByDim(dim int) *Tensor
- func (t *Tensor) SumByDim1(dims []int, keepDims bool) *Tensor
- func (t *Tensor) SumByDim2(dim int, keepdim bool) *Tensor
- func (t *Tensor) Tanh() *Tensor
- func (t *Tensor) TensorData() []float32
- func (t *Tensor) ToDevice(device Device)
- func (t *Tensor) TraceLogToggle()
- func (t *Tensor) Transpose() *Tensor
- func (t *Tensor) TransposeByDim(dim1, dim2 int) *Tensor
- func (t *Tensor) Trilu(k int, upper bool) *Tensor
- func (t *Tensor) TriluMask(k int, upper bool) *Tensor
- func (m *Tensor) X() float32
- func (t *Tensor) Xor(other *Tensor) *Tensor
- func (m *Tensor) Y() float32
- func (m *Tensor) Z() float32
- func (t *Tensor) ZeroGrad()
- func (t *Tensor) ZerosLike() *Tensor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnableTensorTrace ¶
func EnableTensorTrace()
func EndTensorTrace ¶
func EndTensorTrace()
func SetDefaultDevice ¶
func SetDefaultDevice(device Device)
func ShapeEqual ¶
Types ¶
type CpuMemoryDevice ¶
type CpuMemoryDevice struct { Type DeviceType Num DeviceNum }
func (*CpuMemoryDevice) GetDeviceType ¶
func (d *CpuMemoryDevice) GetDeviceType() DeviceType
func (*CpuMemoryDevice) GetIndex ¶
func (d *CpuMemoryDevice) GetIndex() DeviceNum
type DataTrace ¶
type DataTrace struct { TensorData []*Tensor // contains filtered or unexported fields }
func GetDataTrace ¶
func GetDataTrace() *DataTrace
func (*DataTrace) AppendTensorData ¶
func (*DataTrace) LoadDataTraceLog ¶
func (m *DataTrace) LoadDataTraceLog()
func (*DataTrace) WriteDataTraceLog ¶
func (m *DataTrace) WriteDataTraceLog()
type Device ¶
type Device interface { GetDeviceType() DeviceType GetIndex() DeviceNum }
func GetCpuMemoryDevice ¶
func GetCpuMemoryDevice() Device
func GetDefaultDevice ¶
func GetDefaultDevice() Device
type MemoryPool ¶
type MemoryPool struct {
// contains filtered or unexported fields
}
func NewFloat32Pool ¶
func NewFloat32Pool() *MemoryPool
func (*MemoryPool) Clear ¶
func (p *MemoryPool) Clear()
func (*MemoryPool) Delete ¶
func (p *MemoryPool) Delete(key *Tensor) []float32
func (*MemoryPool) Put ¶
func (p *MemoryPool) Put(key *Tensor, data []float32)
type Tensor ¶
type Tensor struct { Data []float32 Device Device //Backward Grad []float32 RequiresGrad bool Parents []*Tensor GradFn func() IsLeaf bool // contains filtered or unexported fields }
func HadamardProduct ¶
func LoadFromCSV ¶
func LoadTensorFromGobFile ¶
func NewEmptyTensor ¶
func NewEmptyTensor() *Tensor
func NewRandomTensor ¶
func NewTensorFromSlice ¶
func NewTensorWithShape ¶
func Perspective ¶
func RandomNormal ¶
func RotateTensor ¶
func TranslateMatrix ¶
func (*Tensor) BakTranspose ¶
func (*Tensor) ContainPanic ¶
func (*Tensor) Conv2DGradientWeight ¶
func (*Tensor) Conv2DTranspose ¶
func (*Tensor) Determinant ¶
func (*Tensor) Dimensions ¶
func (*Tensor) EnableGrad ¶
func (*Tensor) EqualFloat16 ¶
func (*Tensor) EqualFloat32 ¶
func (*Tensor) EqualFloat32WithShape ¶
func (*Tensor) EqualFloat5 ¶
func (*Tensor) EqualWithTolerance ¶
func (*Tensor) FlattenByDim ¶
func (*Tensor) GetShapeByNum ¶
func (*Tensor) Homogeneous ¶
func (*Tensor) MatMulMatrix ¶
func (*Tensor) MatchPanic ¶
func (*Tensor) MeanTensor ¶
func (*Tensor) MulPosition ¶
func (*Tensor) Reciprocal ¶
func (*Tensor) RequireGrad ¶
func (*Tensor) SaveToCSVWithoutShape ¶
func (*Tensor) ScatterAdd ¶
func (*Tensor) ShapesMatch ¶
func (*Tensor) SoftmaxByDim ¶
func (*Tensor) SplitLastDim ¶
func (*Tensor) SqueezeSpecific ¶
func (*Tensor) TensorData ¶
func (*Tensor) TraceLogToggle ¶
func (t *Tensor) TraceLogToggle()
func (*Tensor) TransposeByDim ¶
Source Files
¶
- tensor.go
- tensor_backward.go
- tensor_broadcast.go
- tensor_conv.go
- tensor_cpu_memory_device.go
- tensor_csv.go
- tensor_datatrace.go
- tensor_device.go
- tensor_equal.go
- tensor_latest.go
- tensor_logical_bitwise.go
- tensor_loss.go
- tensor_math.go
- tensor_math_bak.go
- tensor_math_common.go
- tensor_memory_pool.go
- tensor_op.go
- tensor_operation_common.go
- tensor_vector_cg.go
Click to show internal directories.
Click to hide internal directories.