IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Python class

PrintHook

PrintHook​

class max.nn.hooks.PrintHook(export_path=None, filter=None)

source

Bases: BasePrintHook

Hook that prints/saves layer tensor inputs and outputs.

This class must be initialized added before the graph is built so the print ops can be added to the graph.

Parameters:

  • export_path (str | None)
  • filter (list[str] | None)

export_path​

property export_path: str | None

source

name_layers()​

name_layers(model)

source

Create names for all layers in the model based on nested attributes.

Parameters:

model (Layer)

Return type:

None

name_layers_v3()​

name_layers_v3(model)

source

Create names for all v3 Module layers based on nested attributes.

Parameters:

model (Module[..., Any])

Return type:

None

print_value()​

print_value(name, value)

source

Prints a value, and returns whether the print is successful.

Parameters:

Return type:

bool

remove()​

remove()

source

Return type:

None