Documentation
¶
Overview ¶
Package reducesum provides the ReduceSum layer for the Zerfoo ML framework.
Index ¶
- func BuildReduceSum[T tensor.Numeric](engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, ...) (graph.Node[T], error)
- type ReduceSum
- func (r *ReduceSum[T]) Attributes() map[string]interface{}
- func (r *ReduceSum[T]) Backward(ctx context.Context, _ types.BackwardMode, ...) ([]*tensor.TensorNumeric[T], error)
- func (r *ReduceSum[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (r *ReduceSum[T]) OpType() string
- func (r *ReduceSum[T]) OutputShape() []int
- func (r *ReduceSum[T]) Parameters() []*graph.Parameter[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildReduceSum ¶
func BuildReduceSum[T tensor.Numeric]( engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, _ map[string]*graph.Parameter[T], attributes map[string]interface{}, ) (graph.Node[T], error)
BuildReduceSum constructs a ReduceSum node, parsing axes and keepdims from attributes.
Types ¶
type ReduceSum ¶
ReduceSum represents a reduce sum operation.
func (*ReduceSum[T]) Attributes ¶
Attributes returns the attributes.
func (*ReduceSum[T]) Backward ¶
func (r *ReduceSum[T]) Backward(ctx context.Context, _ types.BackwardMode, outputGradient *tensor.TensorNumeric[T], inputs ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the gradients for the ReduceSum layer.
func (*ReduceSum[T]) Forward ¶
func (r *ReduceSum[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward computes the reduce sum operation.
func (*ReduceSum[T]) OutputShape ¶
OutputShape returns the output shape of the ReduceSum layer.
func (*ReduceSum[T]) Parameters ¶
Parameters returns no trainable parameters for the ReduceSum layer.
Click to show internal directories.
Click to hide internal directories.