class_docstr: A decorator which performs input-output neural type checks, and attaches
  neural types to the output of the function that it wraps.
  
  Requires that the class inherit from :class:`~nemo.core.Typing` in order to perform
  type checking, and will raise an error if that is not the case.
  
  # Usage (Class level type support)
  
  .. code-block:: python
  
      @typecheck()
      def fn(self, arg1, arg2, ...):
          ...
  
  # Usage (Function level type support)
  
  .. code-block:: python
  
      @typecheck(input_types=..., output_types=...)
      def fn(self, arg1, arg2, ...):
          ...
  
  Points to be noted:
  
  1) The brackets () in `@typecheck()` are necessary.
  
      You will encounter a TypeError: __init__() takes 1 positional argument but X
      were given without those brackets.
  
  2) The function can take any number of positional arguments during definition.
  
      When you call this function, all arguments must be passed using kwargs only.
class_docstr_tok: ["A","decorator","which","performs","input-output","neural","type","checks",",","and","attaches","neural","types","to","the","output","of","the","function","that","it","wraps",".","Requires","that","the","class","inherit","from",":","class",":","`","~nemo.core.Typing","`","in","order","to","perform","type","checking",",","and","will","raise","an","error","if","that","is","not","the","case",".","#","Usage","(","Class","level","type","support",")","..","code-block",":",":","python","@","typecheck","(",")","def","fn","(","self",",","arg1",",","arg2",",","...",")",":","...","#","Usage","(","Function","level","type","support",")","..","code-block",":",":","python","@","typecheck","(","input_types=","...",",","output_types=","...",")","def","fn","(","self",",","arg1",",","arg2",",","...",")",":","...","Points","to","be","noted",":","1",")","The","brackets","(",")","in","`","@","typecheck","(",")","`","are","necessary",".","You","will","encounter","a","TypeError",":","__init__","(",")","takes","1","positional","argument","but","X","were","given","without","those","brackets",".","2",")","The","function","can","take","any","number","of","positional","arguments","during","definition",".","When","you","call","this","function",",","all","arguments","must","be","passed","using","kwargs","only","."]
docstr: Wrapper method that can be used on any function of a class that implements :class:`~nemo.core.Typing`.
  By default, it will utilize the `input_types` and `output_types` properties of the class inheriting Typing.
  
  Local function level overrides can be provided by supplying dictionaries as arguments to the decorator.
  
  Args:
      input_types: Union[TypeState, Dict[str, NeuralType]]. By default, uses the global `input_types`.
      output_types: Union[TypeState, Dict[str, NeuralType]]. By default, uses the global `output_types`.
      ignore_collections: Bool. Determines if container types should be asserted for depth checks, or
          if depth checks are skipped entirely.
docstr_tok: ["Wrapper","method","that","can","be","used","on","any","function","of","a","class","that","implements",":","class",":","`","~nemo.core.Typing","`",".","By","default",",","it","will","utilize","the","`","input_types","`","and","`","output_types","`","properties","of","the","class","inheriting","Typing",".","Local","function","level","overrides","can","be","provided","by","supplying","dictionaries","as","arguments","to","the","decorator",".","Args",":","input_types",":","Union","[","TypeState",",","Dict","[","str",",","NeuralType","]","]",".","By","default",",","uses","the","global","`","input_types","`",".","output_types",":","Union","[","TypeState",",","Dict","[","str",",","NeuralType","]","]",".","By","default",",","uses","the","global","`","output_types","`",".","ignore_collections",":","Bool",".","Determines","if","container","types","should","be","asserted","for","depth","checks",",","or","if","depth","checks","are","skipped","entirely","."]
code: def __call__(self, wrapped, instance: Typing, args, kwargs):
      """
      Wrapper method that can be used on any function of a class that implements :class:`~nemo.core.Typing`.
      By default, it will utilize the `input_types` and `output_types` properties of the class inheriting Typing.
  
      Local function level overrides can be provided by supplying dictionaries as arguments to the decorator.
  
      Args:
          input_types: Union[TypeState, Dict[str, NeuralType]]. By default, uses the global `input_types`.
          output_types: Union[TypeState, Dict[str, NeuralType]]. By default, uses the global `output_types`.
          ignore_collections: Bool. Determines if container types should be asserted for depth checks, or
              if depth checks are skipped entirely.
  
      """
      if instance is None:
          raise RuntimeError(
              "Only classes which inherit nemo.core.Typing can use this decorator !"
          )
  
      if not isinstance(instance, Typing):
          raise RuntimeError(
              "Only classes which inherit nemo.core.Typing can use this decorator !"
          )
  
      if hasattr(instance, "input_ports") or hasattr(
          instance, "output_ports"
      ):
          raise RuntimeError(
              "Typing requires override of `input_types()` and `output_types()`, "
              "not `input_ports() and `output_ports()`"
          )
  
      # Preserve type information
      if self.input_types is typecheck.TypeState.UNINITIALIZED:
          self.input_types = instance.input_types
  
      if self.output_types is typecheck.TypeState.UNINITIALIZED:
          self.output_types = instance.output_types
  
      # Resolve global type or local overridden type
      if self.input_override:
          input_types = self.input_types
      else:
          input_types = instance.input_types
  
      if self.output_override:
          output_types = self.output_types
      else:
          output_types = instance.output_types
  
      # If types are not defined, skip type checks and just call the wrapped method
      if input_types is None and output_types is None:
          return wrapped(*args, **kwargs)
  
      # Check that all arguments are kwargs
      if input_types is not None and len(args) > 0:
          raise TypeError(
              "All arguments must be passed by kwargs only for typed methods"
          )
  
      # Perform rudimentary input checks here
      instance._validate_input_types(
          input_types=input_types,
          ignore_collections=self.ignore_collections,
          **kwargs,
      )
  
      # Call the method - this can be forward, or any other callable method
      outputs = wrapped(*args, **kwargs)
  
      instance._attach_and_validate_output_types(
          output_types=output_types,
          ignore_collections=self.ignore_collections,
          out_objects=outputs,
      )
  
      return outputs
  
imports: import hashlib
  import inspect
  import traceback
  from abc import ABC, abstractmethod
  from contextlib import contextmanager
  from dataclasses import dataclass, field
  from enum import Enum
  from functools import total_ordering
  from pathlib import Path
  from typing import Dict, Iterable, List, Optional, Tuple, Union
  import hydra
  import torch
  import wrapt
  from huggingface_hub import HfApi, HfFolder, ModelFilter, hf_hub_download
  from huggingface_hub.hf_api import ModelInfo
  from omegaconf import DictConfig, OmegaConf
  import nemo
  from nemo.core.connectors.save_restore_connector import SaveRestoreConnector
  from nemo.core.neural_types import NeuralType, NeuralTypeComparisonResult
  from nemo.utils import logging
  from nemo.utils.cloud import maybe_download_from_cloud
  from nemo.utils.data_utils import resolve_cache_dir
  from nemo.utils.model_utils import import_class_by_path, maybe_update_config_version
label_desc: Use image node_id 2 for calling the typecheck obj's underlying member method code with example usage: obj.__call__(wrapped, instance, args, kwargs) and returns: outputs, wrapped