class_docstr: Mixin that provides save and load functionalities.
class_docstr_tok: ["Mixin","that","provides","save","and","load","functionalities","."]
code: def __load(self, dirname, ancestors):
      ancestors.append(self)
      for attr in self.saved_attributes:
          assert hasattr(self, attr)
          attr_value = getattr(self, attr)
          if attr_value is None:
              continue
          if isinstance(attr_value, AttributeSavingMixin):
              assert not any(
                  attr_value is ancestor for ancestor in ancestors
              ), "Avoid an infinite loop"
              attr_value.load(os.path.join(dirname, attr))
          else:
              """Fix Chainer Issue #2772
  
              In Chainer v2, a (stateful) optimizer cannot be loaded from
              an npz saved before the first update.
              """
              load_npz_no_strict(
                  os.path.join(dirname, "{}.npz".format(attr)),
                  getattr(self, attr),
              )
      ancestors.pop()
  
imports: from abc import ABCMeta
  from abc import abstractmethod
  from abc import abstractproperty
  import os
  from chainer import serializers
  import numpy
  import warnings
label_desc: Use image node_id 5 for calling the AttributeSavingMixin obj's underlying member method code with example usage: obj.__load(dirname, ancestors) without return types