TrainingExtensions/torch/src/python/aimet_torch/meta/connectedgraph.py
def forward_hook(curr_module: torch.nn.Module,
                         inputs: Union[torch.Tensor, List, Dict, None],
                         outputs: Union[torch.Tensor, List, Dict, None]):
            """
            Custom forward hook function to add every module to module-to-tensor shapes dict.
            :param curr_module: Current module being traversed during forward pass.
            :param inputs: tuple of input tensors to the current module
            :param outputs: tuple of output tensors of the current module
            """
            input_shapes = _get_module_tensor_shapes_entry(inputs)
            output_shapes = _get_module_tensor_shapes_entry(outputs)
            if not isinstance(input_shapes, List):
                input_shapes = [input_shapes]
            if not isinstance(output_shapes, List):
                output_shapes = [output_shapes]
            module_tensor_shapes_map[curr_module] = (input_shapes, output_shapes)

            Custom forward hook function to add every module to module-to-tensor shapes dict.
            :param curr_module: Current module being traversed during forward pass.
            :param inputs: tuple of input tensors to the current module
            :param outputs: tuple of output tensors of the current module
            
Custom forward hook function to add every module to module-to-tensor shapes dict.
Custom forward hook function to add every module to module - to - tensor shapes dict .
def forward_hook(curr_module: torch.nn.Module,
                         inputs: Union[torch.Tensor, List, Dict, None],
                         outputs: Union[torch.Tensor, List, Dict, None]):
            input_shapes = _get_module_tensor_shapes_entry(inputs)
            output_shapes = _get_module_tensor_shapes_entry(outputs)
            if not isinstance(input_shapes, List):
                input_shapes = [input_shapes]
            if not isinstance(output_shapes, List):
                output_shapes = [output_shapes]
            module_tensor_shapes_map[curr_module] = (input_shapes, output_shapes)
def forward_hook ( curr_module : torch . nn . Module , inputs : Union [ torch . Tensor , List , Dict , None ] , outputs : Union [ torch . Tensor , List , Dict , None ] ) : input_shapes = _get_module_tensor_shapes_entry ( inputs ) output_shapes = _get_module_tensor_shapes_entry ( outputs ) if not isinstance ( input_shapes , List ) : input_shapes = [ input_shapes ] if not isinstance ( output_shapes , List ) : output_shapes = [ output_shapes ] module_tensor_shapes_map [ curr_module ] = ( input_shapes , output_shapes )
Custom forward hook function to add every module to module-to-tensor shapes dict.
Custom forward hook function to add every module to module - to - tensor shapes dict .
"""
            Custom forward hook function to add every module to module-to-tensor shapes dict.
            :param curr_module: Current module being traversed during forward pass.
            :param inputs: tuple of input tensors to the current module
            :param outputs: tuple of output tensors of the current module
            """
curr_module
torch.nn.Module
Current module being traversed during forward pass.
Current module being traversed during forward pass .
inputs
Union[torch.Tensor, List, Dict, None]
tuple of input tensors to the current module
tuple of input tensors to the current module
outputs
Union[torch.Tensor, List, Dict, None]
tuple of output tensors of the current module
tuple of output tensors of the current module