TrainingExtensions/torch/src/python/aimet_torch/cross_layer_equalization.py
def does_module_have_relu_activation(connected_graph: ConnectedGraph, module: torch.nn.Module) -> bool:
        """
        Finds if a given module has a ReLU activation
        :param connected_graph: Reference to ConnectedGraph instance
        :param module: PyTorch module to find activation for
        :return: True if module has a relu activation
        """

        for op in connected_graph.get_all_ops().values():

            if op.model_module and op.model_module.get_module() is module:
                assert len(op.output.consumers) == 1
                is_relu_activation = isinstance(op.output.consumers[0].model_module.get_module(),
                                                (torch.nn.ReLU, torch.nn.PReLU))
                return is_relu_activation

        return False

        Finds if a given module has a ReLU activation
        :param connected_graph: Reference to ConnectedGraph instance
        :param module: PyTorch module to find activation for
        :return: True if module has a relu activation
        
Finds if a given module has a ReLU activation
Finds if a given module has a ReLU activation
def does_module_have_relu_activation(connected_graph: ConnectedGraph, module: torch.nn.Module) -> bool:
        for op in connected_graph.get_all_ops().values():
            if op.model_module and op.model_module.get_module() is module:
                assert len(op.output.consumers) == 1
                is_relu_activation = isinstance(op.output.consumers[0].model_module.get_module(),
                                                (torch.nn.ReLU, torch.nn.PReLU))
                return is_relu_activation
        return False
def does_module_have_relu_activation ( connected_graph : ConnectedGraph , module : torch . nn . Module ) -> bool : for op in connected_graph . get_all_ops ( ) . values ( ) : if op . model_module and op . model_module . get_module ( ) is module : assert len ( op . output . consumers ) == 1 is_relu_activation = isinstance ( op . output . consumers [ 0 ] . model_module . get_module ( ) , ( torch . nn . ReLU , torch . nn . PReLU ) ) return is_relu_activation return False
Finds if a given module has a ReLU activation
Finds if a given module has a ReLU activation
"""
        Finds if a given module has a ReLU activation
        :param connected_graph: Reference to ConnectedGraph instance
        :param module: PyTorch module to find activation for
        :return: True if module has a relu activation
        """
True if module has a relu activation
True if module has a relu activation
connected_graph
ConnectedGraph
Reference to ConnectedGraph instance
Reference to ConnectedGraph instance
module
torch.nn.Module
PyTorch module to find activation for
PyTorch module to find activation for