xnn.gnn.constants.register_constant#

xnn.gnn.constants.register_constant(module, name, value, persistent=True)[source]#

Register value as a floating buffer that stays exact in float64.

The buffer is made in the default dtype, as a plain register_buffer would; the value itself is kept in float64, so exact_float64_constants() can restore it once the module is float64.

Parameters:
  • module (torch.nn.Module) – The module that owns the buffer.

  • name (str) – The buffer name.

  • value (float, sequence of float or torch.Tensor) – The constant, as exact as the caller has it.

  • persistent (bool, optional) – Whether the buffer is part of the state_dict, by default True.

Return type:

None