# tensorplay.nn.modules.module.register_module_buffer_registration_hook

Source: https://www.tensorplay.cn/docs/generated/tensorplay.nn.modules.module.register_module_buffer_registration_hook.html

# tensorplay.nn.modules.module.register_module_buffer_registration_hook

tensorplay.nn.modules.module.register_module_buffer_registration_hook(hook: [Callable](https://docs.python.org/3/library/typing.html#typing.Callable)[[...], [None](https://docs.python.org/3/library/constants.html#None)]) &#x2192; RemovableHandle[[source]](../_modules/tensorplay/nn/modules/module.html#register_module_buffer_registration_hook)

Register a buffer registration hook common to all modules.

Warning

This adds global state to the nn.Module module

The hook will be called every time register_buffer() is invoked.
It should have the following signature:

```
hook(module, name, buffer) -> None or new buffer
```

The hook can modify the input or return a single modified value in the hook.

Returns:

a handle that can be used to remove the added hook by calling
handle.remove()

Return type:

tensorplay.utils.hooks.RemovableHandle
