original_docstring: Estimate the number of multiply-accumulation operations performed by the module
  
      Args:
          module (torch.nn.Module): PyTorch module
          input (torch.Tensor): input to the module
          output (torch.Tensor): output of the module
      Returns:
          int: number of MACs
      
docstring: Estimate the number of multiply-accumulation operations performed by the module
docstring_tokens: Estimate the number of multiply - accumulation operations performed by the module
code: def module_macs(module: Module, input: Tensor, output: Tensor) -> int:
      """Estimate the number of multiply-accumulation operations performed by the module
  
      Args:
          module (torch.nn.Module): PyTorch module
          input (torch.Tensor): input to the module
          output (torch.Tensor): output of the module
      Returns:
          int: number of MACs
      """
      if isinstance(module, nn.Linear):
          return macs_linear(module, input, output)
      elif isinstance(module, (nn.Identity, nn.ReLU, nn.ELU, nn.LeakyReLU, nn.ReLU6, nn.Tanh, nn.Sigmoid, nn.Flatten)):
          return 0
      elif isinstance(module, _ConvTransposeNd):
          return macs_convtransposend(module, input, output)
      elif isinstance(module, _ConvNd):
          return macs_convnd(module, input, output)
      elif isinstance(module, _BatchNorm):
          return macs_bn(module, input, output)
      elif isinstance(module, _MaxPoolNd):
          return macs_maxpool(module, input, output)
      elif isinstance(module, _AvgPoolNd):
          return macs_avgpool(module, input, output)
      elif isinstance(module, _AdaptiveMaxPoolNd):
          return macs_adaptive_maxpool(module, input, output)
      elif isinstance(module, _AdaptiveAvgPoolNd):
          return macs_adaptive_avgpool(module, input, output)
      elif isinstance(module, nn.Dropout):
          return 0
      else:
          warnings.warn(f'Module type not supported: {module.__class__.__name__}')
          return 0
code_tokens: def module_macs ( module : Module , input : Tensor , output : Tensor ) -> int : if isinstance ( module , nn . Linear ) : return macs_linear ( module , input , output ) elif isinstance ( module , ( nn . Identity , nn . ReLU , nn . ELU , nn . LeakyReLU , nn . ReLU6 , nn . Tanh , nn . Sigmoid , nn . Flatten ) ) : return 0 elif isinstance ( module , _ConvTransposeNd ) : return macs_convtransposend ( module , input , output ) elif isinstance ( module , _ConvNd ) : return macs_convnd ( module , input , output ) elif isinstance ( module , _BatchNorm ) : return macs_bn ( module , input , output ) elif isinstance ( module , _MaxPoolNd ) : return macs_maxpool ( module , input , output ) elif isinstance ( module , _AvgPoolNd ) : return macs_avgpool ( module , input , output ) elif isinstance ( module , _AdaptiveMaxPoolNd ) : return macs_adaptive_maxpool ( module , input , output ) elif isinstance ( module , _AdaptiveAvgPoolNd ) : return macs_adaptive_avgpool ( module , input , output ) elif isinstance ( module , nn . Dropout ) : return 0 else : warnings . warn ( f'Module type not supported: {module.__class__.__name__}' ) return 0
short_docstring: Estimate the number of multiply-accumulation operations performed by the module
short_docstring_tokens: Estimate the number of multiply - accumulation operations performed by the module
comment: """Estimate the number of multiply-accumulation operations performed by the module
  
      Args:
          module (torch.nn.Module): PyTorch module
          input (torch.Tensor): input to the module
          output (torch.Tensor): output of the module
      Returns:
          int: number of MACs
      """