nip.utils.torch.Print

nip.utils.torch.Print#

class nip.utils.torch.Print(name: str = None, mode: bool = False, transform: Callable | None = None)[source]#

Print information about an input tensor.

Parameters:
  • name (str, default=None) – The name of the tensor.

  • mode (str, default="shape") –

    The mode to print. One of the following:

    • ”shape”: Print the shape of the tensor.

    • ”value”: Print the value of the tensor.

    • ”nan”: Print the fraction of NaN values in the tensor.

  • transform (Callable, default=None) – A function to apply to the tensor before printing.

Methods Summary

__init__([name, mode, transform])

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(x)

Print the information about the input tensor.

Attributes

T_destination

call_super_init

dump_patches

training

Methods

__init__(name: str = None, mode: bool = False, transform: Callable | None = None)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(x: Tensor) Tensor[source]#

Print the information about the input tensor.

Parameters:

x (Tensor) – The input tensor.

Returns:

x (Tensor) – The input tensor, unchanged.