transpose

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package transpose provides the Transpose layer for the Zerfoo ML framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTranspose

func BuildTranspose[T tensor.Numeric](
	engine compute.Engine[T],
	_ numeric.Arithmetic[T],
	_ string,
	_ map[string]*graph.Parameter[T],
	attributes map[string]interface{},
) (graph.Node[T], error)

BuildTranspose constructs a Transpose node, reading the permutation from attributes.

Types

type Transpose

type Transpose[T tensor.Numeric] struct {
	// contains filtered or unexported fields
}

Transpose represents a transpose operation.

func New

func New[T tensor.Numeric](engine compute.Engine[T], axes []int) *Transpose[T]

New creates a new Transpose layer.

func (*Transpose[T]) Attributes

func (t *Transpose[T]) Attributes() map[string]interface{}

Attributes returns the attributes.

func (*Transpose[T]) Backward

func (t *Transpose[T]) Backward(ctx context.Context, _ types.BackwardMode, outputGradient *tensor.TensorNumeric[T], _ ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)

Backward computes the gradients for the Transpose layer.

func (*Transpose[T]) Forward

func (t *Transpose[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)

Forward computes the transpose operation.

func (*Transpose[T]) OpType

func (t *Transpose[T]) OpType() string

OpType returns the operation type.

func (*Transpose[T]) OutputShape

func (t *Transpose[T]) OutputShape() []int

OutputShape returns the output shape of the Transpose layer.

func (*Transpose[T]) Parameters

func (t *Transpose[T]) Parameters() []*graph.Parameter[T]

Parameters returns no trainable parameters for the Transpose layer.

Jump to

Keyboard shortcuts

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