tensor

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tensor

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

Tensor is a multidimensional array structure wrapping gonum/mat.Dense

func NewOnes

func NewOnes(shape ...int) (*Tensor, error)

NewOnes は指定された形状の1で埋められたテンソルを作成する

func NewTensor

func NewTensor(data []float64, shape ...int) (*Tensor, error)

NewTensor creates a new tensor

func NewTensorFromDense

func NewTensorFromDense(dense *mat.Dense) *Tensor

NewTensorFromDense creates a new tensor from mat.Dense

func NewZeros

func NewZeros(shape ...int) (*Tensor, error)

NewZeros は指定された形状のゼロテンソルを作成する

func (*Tensor) At

func (t *Tensor) At(i, j int) float64

At は指定された位置の値を返す

func (*Tensor) Copy

func (t *Tensor) Copy() *Tensor

Copy はテンソルのディープコピーを作成する

func (*Tensor) Data

func (t *Tensor) Data() *mat.Dense

Data は内部のmat.Denseへの参照を返す 注意: 直接操作は推奨されない

func (*Tensor) Dims

func (t *Tensor) Dims() (int, int)

Dims はテンソルの次元(行数、列数)を返す

func (*Tensor) RawData

func (t *Tensor) RawData() []float64

RawData は内部データのコピーをスライスとして返す

func (*Tensor) Reshape

func (t *Tensor) Reshape(shape ...int) error

Reshape はテンソルの形状を変更する

func (*Tensor) Set

func (t *Tensor) Set(i, j int, v float64)

Set は指定された位置に値を設定する

func (*Tensor) Shape

func (t *Tensor) Shape() []int

Shape はテンソルの形状を返す

func (*Tensor) Slice

func (t *Tensor) Slice(rowStart, rowEnd, colStart, colEnd int) (*Tensor, error)

Slice は指定された範囲のスライスを返す

func (*Tensor) T

func (t *Tensor) T() *Tensor

T はテンソルの転置を返す

Jump to

Keyboard shortcuts

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