class_docstr: An interface which endows module with neural types
class_docstr_tok: ["An","interface","which","endows","module","with","neural","types"]
docstr: Recursively attach neural types to a given object - as long as it can be assigned some value.
  
  Args:
      obj: Any python object that can be assigned a value.
      metadata: TypecheckMetadata object.
      depth: Current depth of recursion.
      name: Optional name used of the source obj, used when an error occurs.
docstr_tok: ["Recursively","attach","neural","types","to","a","given","object","-","as","long","as","it","can","be","assigned","some","value",".","Args",":","obj",":","Any","python","object","that","can","be","assigned","a","value",".","metadata",":","TypecheckMetadata","object",".","depth",":","Current","depth","of","recursion",".","name",":","Optional","name","used","of","the","source","obj",",","used","when","an","error","occurs","."]
code: def __attach_neural_type(
      self,
      obj,
      metadata: TypecheckMetadata,
      depth: int,
      name: str = None,
  ):
      """
      Recursively attach neural types to a given object - as long as it can be assigned some value.
  
      Args:
          obj: Any python object that can be assigned a value.
          metadata: TypecheckMetadata object.
          depth: Current depth of recursion.
          name: Optional name used of the source obj, used when an error occurs.
      """
      if isinstance(obj, tuple) or isinstance(obj, list):
          for elem in obj:
              self.__attach_neural_type(
                  elem, metadata, depth=depth + 1, name=name
              )
          return  # after processing nest, return to avoid argument insertion into nest itself
  
      type_val = metadata.base_types[name]
  
      # If nest depth doesnt match neural type structure depth, raise an error
      if (
          not metadata.ignore_collections
          and depth != metadata.container_depth[name]
      ):
          raise TypeError(
              "While attaching output neural types,\n"
              "Nested depth of value did not match container specification:\n"
              f"Current nested depth of NeuralType '{name}' ({type_val}): {depth}\n"
              f"Expected nested depth : {metadata.container_depth[name]}"
          )
  
      try:
          obj.neural_type = type_val
      except Exception:
          pass
  
      # Perform output ndim check
      if hasattr(obj, "shape"):
          value_shape = obj.shape
          type_shape = type_val.axes
  
          if type_shape is not None and len(value_shape) != len(
              type_shape
          ):
              raise TypeError(
                  f"Output shape mismatch occured for {name} in module {self.__class__.__name__} : \n"
                  f"Output shape expected = {type_shape} | \n"
                  f"Output shape found : {value_shape}"
              )
  
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 6 for calling the Typing obj's underlying member method code with example usage: obj.__attach_neural_type(obj, metadata, depth, name) without return types