class_docstr: Convenience class for periodically snapshotting.
  
  Objects which can be snapshotted are limited to Sonnet or tensorflow Modules
  which implement a __call__ method. This will save the module's graph and
  variables such that they can be loaded later using `tf.saved_model.load`. See
  https://www.tensorflow.org/guide/saved_model for more details.
  
  The Snapshotter is typically used to save infrequent permanent self-contained
  snapshots which can be loaded later for inspection. For frequent saving of
  model parameters in order to guard against pre-emption of the learning process
  see the Checkpointer class.
  
  Usage example:
  
  ```python
  model = snt.Linear(10)
  snapshotter = Snapshotter(objects_to_save={'model': model})
  
  for _ in range(100):
    # ...
    snapshotter.save()
  ```
class_docstr_tok: ["Convenience","class","for","periodically","snapshotting",".","Objects","which","can","be","snapshotted","are","limited","to","Sonnet","or","tensorflow","Modules","which","implement","a","__call__","method",".","This","will","save","the","module","'s","graph","and","variables","such","that","they","can","be","loaded","later","using","`","tf.saved_model.load","`",".","See","https",":","\/\/www.tensorflow.org\/guide\/saved_model","for","more","details",".","The","Snapshotter","is","typically","used","to","save","infrequent","permanent","self-contained","snapshots","which","can","be","loaded","later","for","inspection",".","For","frequent","saving","of","model","parameters","in","order","to","guard","against","pre-emption","of","the","learning","process","see","the","Checkpointer","class",".","Usage","example",":","``","`","python","model","=","snt.Linear","(","10",")","snapshotter","=","Snapshotter","(","objects_to_save=","{","'model","'",":","model","}",")","for","_","in","range","(","100",")",":","#","...","snapshotter.save","(",")","``","`"]
docstr: Snapshots if it's the appropriate time, otherwise no-ops.
  
  Args:
    force: If True, save new snapshot no matter how long it's been since the
      last one.
  
  Returns:
    A boolean indicating if a save event happened.
docstr_tok: ["Snapshots","if","it","'s","the","appropriate","time",",","otherwise","no-ops",".","Args",":","force",":","If","True",",","save","new","snapshot","no","matter","how","long","it","'s","been","since","the","last","one",".","Returns",":","A","boolean","indicating","if","a","save","event","happened","."]
code: def save(self, force: bool = False) -> bool:
      """Snapshots if it's the appropriate time, otherwise no-ops.
  
      Args:
        force: If True, save new snapshot no matter how long it's been since the
          last one.
  
      Returns:
        A boolean indicating if a save event happened.
      """
      seconds_since_last = time.time() - self._last_saved
      if self._snapshots and (
          force or seconds_since_last >= 60 * self._time_delta_minutes
      ):
          # Save any snapshots.
          for path, snapshot in self._snapshots.items():
              tf.saved_model.save(snapshot, path)
  
          # Record the time we finished saving.
          self._last_saved = time.time()
  
          return True
  
      return False
  
imports: import abc
  import datetime
  import os
  import pickle
  import time
  from typing import Mapping, Optional, Union
  from absl import logging
  from acme import core
  from acme.utils import signals
  from acme.utils import paths
  import sonnet
  import tensorflow
  import tree
  from tensorflow.python.saved_model import revived_types
label_desc: Use image node_id 2 for calling the Snapshotter obj's underlying member method code with example usage: obj.save(force) and returns: False, True