class_docstr: Class performing adversarial training following Oracle Aligned Adversarial Training (OAAT) protocol.
  
  | Paper link: https://link.springer.com/chapter/10.1007/978-3-031-20065-6_18
class_docstr_tok: ["Class","performing","adversarial","training","following","Oracle","Aligned","Adversarial","Training","(","OAAT",")","protocol",".","|","Paper","link",":","https",":","\/\/link.springer.com\/chapter\/10.1007\/978-3-031-20065-6_18"]
docstr: Calculates a given model's different layers' parameters' shape and norm, and model parameter norm.
  
  :param p_classifier: model for awp protocol.
  :return: tuple with first element a dictionary with model parameters' names as keys and a nested dictionary
  as value. The nested dictionary contains model parameters, model parameters' size, model parameters' norms.
  The second element of tuple denotes norm of all model parameters
docstr_tok: ["Calculates","a","given","model","'s","different","layers","'","parameters","'","shape","and","norm",",","and","model","parameter","norm",".",":","param","p_classifier",":","model","for","awp","protocol",".",":","return",":","tuple","with","first","element","a","dictionary","with","model","parameters","'","names","as","keys","and","a","nested","dictionary","as","value",".","The","nested","dictionary","contains","model","parameters",",","model","parameters","'","size",",","model","parameters","'","norms",".","The","second","element","of","tuple","denotes","norm","of","all","model","parameters"]
code: def _calculate_model_params(
      p_classifier: PyTorchClassifier,
  ) -> Tuple[Dict[str, Dict[str, "torch.Tensor"]], "torch.Tensor"]:
      """
      Calculates a given model's different layers' parameters' shape and norm, and model parameter norm.
  
      :param p_classifier: model for awp protocol.
      :return: tuple with first element a dictionary with model parameters' names as keys and a nested dictionary
      as value. The nested dictionary contains model parameters, model parameters' size, model parameters' norms.
      The second element of tuple denotes norm of all model parameters
      """
      import torch
  
      params_dict: Dict[str, Dict[str, "torch.Tensor"]] = OrderedDict()
      list_params = []
      for name, param in p_classifier.model.state_dict().items():
          if len(param.size()) <= 1:
              continue
          if "weight" in name:
              temp_param = param.reshape(-1)
              list_params.append(temp_param)
              params_dict[name] = OrderedDict()
              params_dict[name]["param"] = temp_param
              params_dict[name]["size"] = param.size()
              params_dict[name]["norm"] = temp_param.norm()
  
      model_all_params = torch.cat(list_params)
      model_all_params_norm = model_all_params.norm()
      return params_dict, model_all_params_norm
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from collections import OrderedDict
  import logging
  import os
  import time
  from typing import Optional, Tuple, TYPE_CHECKING, List, Dict, Union
  import six
  import numpy
  from tqdm.auto import trange
  from art import config
  from art.defences.trainer.adversarial_trainer_oaat import AdversarialTrainerOAAT
  from art.estimators.classification.pytorch import PyTorchClassifier
  from art.data_generators import DataGenerator
  from art.attacks.attack import EvasionAttack
  from art.utils import check_and_transform_label_format, random_sphere
  from art.config import ART_NUMPY_DTYPE
label_desc: Use image node_id 6 for calling the AdversarialTrainerOAATPyTorch obj's underlying member method code with example usage: obj._calculate_model_params(p_classifier) and returns: params_dict,  model_all_params_norm