@error_handling_agent.catch_smdebug_errors()
def register_block(self, block):
    '\n        This function registers the forward hook. If user wants to register the hook\n        for every child in the given block, then the function calls "apply" API for\n        registration of the hook.\n        The hook is registered recursively, if user has specified the collections that are more than\n        the default collectors viz. gradients, weight and bias\n        '
    if (not isinstance(block, mx.gluon.Block)):
        self.logger.error(f'The given block type {block.__class__.__name__} is unsupported.')
        return
    if (block in self.registered_blocks):
        self.logger.warning(f'The hook is already registered to block {block.name}')
        return
    if isinstance(block, mx.gluon.loss.Loss):
        self.logger.info(f'Registering hook for block {block.name}')
        block.register_forward_hook(self.forward_hook)
        self.registered_blocks.add(block)
        return
    else:
        self.model = block
    is_recursive = self._is_recursive_needed()
    block.register_forward_pre_hook(self.forward_pre_hook)
    if (is_recursive is True):
        block.apply(self._recursive_apply)
    else:
        block.register_forward_hook(self.forward_hook)
        self.registered_blocks.add(block)
This function registers the forward hook. If user wants to register the hook
for every child in the given block, then the function calls "apply" API for
registration of the hook.
The hook is registered recursively, if user has specified the collections that are more than
the default collectors viz. gradients, weight and bias
@error_handling_agent.catch_smdebug_errors()
def register_block(self, block):
    '\n        This function registers the forward hook. If user wants to register the hook\n        for every child in the given block, then the function calls "apply" API for\n        registration of the hook.\n        The hook is registered recursively, if user has specified the collections that are more than\n        the default collectors viz. gradients, weight and bias\n        '
    if (not isinstance(block, mx.gluon.Block)):
        self.logger.error(f'The given block type {block.__class__.__name__} is unsupported.')
        return
    if (block in self.registered_blocks):
        self.logger.warning(f'The hook is already registered to block {block.name}')
        return
    if isinstance(block, mx.gluon.loss.Loss):
        self.logger.info(f'Registering hook for block {block.name}')
        block.register_forward_hook(self.forward_hook)
        self.registered_blocks.add(block)
        return
    else:
        self.model = block
    is_recursive = self._is_recursive_needed()
    block.register_forward_pre_hook(self.forward_pre_hook)
    if (is_recursive is True):
        block.apply(self._recursive_apply)
    else:
        block.register_forward_hook(self.forward_hook)
        self.registered_blocks.add(block)