class_docstr: A class that provides a way to access the submodules and parameters/buffers of a module.
  
  It provides caching mechanism to speed up submodule lookups.
  This is useful for functional programming to manipulate the module state.
class_docstr_tok: ["A","class","that","provides","a","way","to","access","the","submodules","and","parameters\/buffers","of","a","module",".","It","provides","caching","mechanism","to","speed","up","submodule","lookups",".","This","is","useful","for","functional","programming","to","manipulate","the","module","state","."]
docstr: Swap the submodule specified by the given ``path`` to ``value``.
  
  For example, to swap the attribute mod.layer1.conv1 use
  ``accessor.swap_submodule("layer1.conv1", conv2)``.
docstr_tok: ["Swap","the","submodule","specified","by","the","given","``","path","``","to","``","value","``",".","For","example",",","to","swap","the","attribute","mod.layer1.conv1","use","``","accessor.swap_submodule","(","``","layer1.conv1","''",",","conv2",")","``","."]
code: def swap_submodule(
      self, path: str, value: "torch.nn.Module"
  ) -> "torch.nn.Module":
      """
      Swap the submodule specified by the given ``path`` to ``value``.
  
      For example, to swap the attribute mod.layer1.conv1 use
      ``accessor.swap_submodule("layer1.conv1", conv2)``.
      """
      prefix, _, attr = path.rpartition(".")
      return swap_submodule(self.get_submodule(prefix), attr, value)
  
imports: from typing import Dict, Iterable, List, Tuple
  import torch
label_desc: Use image node_id 3 for calling the NamedMemberAccessor obj's underlying member method code with example usage: obj.swap_submodule(path, value) and returns: swap_submodule