class_docstr: Holds buffers in a dictionary.
  
  BufferDict can be indexed like a regular Python dictionary, but buffers it
  contains are properly registered, and will be visible by all Module methods.
  
  :class:`~torch.nn.BufferDict` is an **ordered** dictionary that respects
  
  * the order of insertion, and
  
  * in :meth:`~torch.nn.BufferDict.update`, the order of the merged ``OrderedDict``
    or another :class:`~torch.nn.BufferDict` (the argument to
    :meth:`~torch.nn.BufferDict.update`).
  
  Note that :meth:`~torch.nn.BufferDict.update` with other unordered mapping
  types (e.g., Python's plain ``dict``) does not preserve the order of the
  merged mapping.
  
  Args:
      buffers (iterable, optional): a mapping (dictionary) of
          (string : :class:`~torch.Tensor`) or an iterable of key-value pairs
          of type (string, :class:`~torch.Tensor`)
  
  Example::
  
      class MyModule(nn.Module):
          def __init__(self):
              super(MyModule, self).__init__()
              self.buffers = nn.BufferDict({
                      'left': torch.randn(5, 10),
                      'right': torch.randn(5, 10)
              })
  
          def forward(self, x, choice):
              x = self.buffers[choice].mm(x)
              return x
docstr: Update the :class:`~torch.nn.BufferDict` with the key-value pairs from a
  mapping or an iterable, overwriting existing keys.
  
  .. note::
      If :attr:`buffers` is an ``OrderedDict``, a :class:`~torch.nn.BufferDict`,
      or an iterable of key-value pairs, the order of new elements in it is
      preserved.
  
  Args:
      buffers (iterable): a mapping (dictionary) from string to
          :class:`~torch.Tensor`, or an iterable of
          key-value pairs of type (string, :class:`~torch.Tensor`)
docstr_tok: ["Update","the",":","class",":","`","~torch.nn.BufferDict","`","with","the","key-value","pairs","from","a","mapping","or","an","iterable",",","overwriting","existing","keys",".","..","note",":",":","If",":","attr",":","`","buffers","`","is","an","``","OrderedDict","``",",","a",":","class",":","`","~torch.nn.BufferDict","`",",","or","an","iterable","of","key-value","pairs",",","the","order","of","new","elements","in","it","is","preserved",".","Args",":","buffers","(","iterable",")",":","a","mapping","(","dictionary",")","from","string","to",":","class",":","`","~torch.Tensor","`",",","or","an","iterable","of","key-value","pairs","of","type","(","string",",",":","class",":","`","~torch.Tensor","`",")"]
code: def update(self, buffers):
      r"""Update the :class:`~torch.nn.BufferDict` with the key-value pairs from a
      mapping or an iterable, overwriting existing keys.
  
      .. note::
          If :attr:`buffers` is an ``OrderedDict``, a :class:`~torch.nn.BufferDict`,
          or an iterable of key-value pairs, the order of new elements in it is
          preserved.
  
      Args:
          buffers (iterable): a mapping (dictionary) from string to
              :class:`~torch.Tensor`, or an iterable of
              key-value pairs of type (string, :class:`~torch.Tensor`)
      """
      if not isinstance(buffers, collections.abc.Iterable):
          raise TypeError(
              "BuffersDict.update should be called with an "
              "iterable of key/value pairs, but got "
              + type(buffers).__name__
          )
  
      if isinstance(buffers, collections.abc.Mapping):
          if isinstance(buffers, (OrderedDict, BufferDict)):
              for key, buffer in buffers.items():
                  self[key] = buffer
          else:
              for key, buffer in sorted(buffers.items()):
                  self[key] = buffer
      else:
          for j, p in enumerate(buffers):
              if not isinstance(p, collections.abc.Iterable):
                  raise TypeError(
                      "BufferDict update sequence element "
                      "#"
                      + str(j)
                      + " should be Iterable; is"
                      + type(p).__name__
                  )
              if not len(p) == 2:
                  raise ValueError(
                      "BufferDict update sequence element "
                      "#"
                      + str(j)
                      + " has length "
                      + str(len(p))
                      + "; 2 is required"
                  )
              self[p[0]] = p[1]
  
imports: from __future__ import annotations
  import collections
  from collections import OrderedDict
  import torch
  from torch.nn import Module
label_desc: Use image node_id 13 for calling the BufferDict obj's underlying member method code with example usage: obj.update(buffers) without return types