hrm

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 hrm implements the Hierarchical Reasoning Model.

Package hrm implements the Hierarchical Reasoning Model.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HModule

type HModule[T tensor.Numeric] struct {
	Block       *transformer.Block[T]
	HiddenState *tensor.TensorNumeric[T]
}

HModule represents the high-level recurrent module of the HRM.

func NewHModule

func NewHModule[T tensor.Numeric](
	engine compute.Engine[T],
	ops numeric.Arithmetic[T],
	modelDim, ffnDim int,
	attention graph.Node[T],
	opts ...transformer.BlockOption[T],
) (*HModule[T], error)

NewHModule creates a new HModule.

func (*HModule[T]) Forward

func (m *HModule[T]) Forward(ctx context.Context, lState *tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)

Forward performs a single step of the HModule's computation.

func (*HModule[T]) Parameters

func (m *HModule[T]) Parameters() []*graph.Parameter[T]

Parameters returns the parameters of the HModule.

type LModule

type LModule[T tensor.Numeric] struct {
	Block       *transformer.Block[T]
	HiddenState *tensor.TensorNumeric[T]
}

LModule represents the low-level recurrent module of the HRM.

func NewLModule

func NewLModule[T tensor.Numeric](
	engine compute.Engine[T],
	ops numeric.Arithmetic[T],
	modelDim, ffnDim int,
	attention graph.Node[T],
	opts ...transformer.BlockOption[T],
) (*LModule[T], error)

NewLModule creates a new LModule.

func (*LModule[T]) Forward

func (m *LModule[T]) Forward(
	ctx context.Context,
	hState, projectedInput *tensor.TensorNumeric[T],
) (*tensor.TensorNumeric[T], error)

Forward performs a single step of the LModule's computation.

func (*LModule[T]) Parameters

func (m *LModule[T]) Parameters() []*graph.Parameter[T]

Parameters returns the parameters of the LModule.

Jump to

Keyboard shortcuts

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