class_docstr: Object that handles update schedule and configurations.
  
  Args:
      replay_buffer (ReplayBuffer): Replay buffer
      update_func (callable): Callable that accepts one of these:
          (1) a list of transition dicts (if episodic_update=False)
          (2) a list of lists of transition dicts (if episodic_update=True)
      replay_start_size (int): if the replay buffer's size is less than
          replay_start_size, skip update
      batchsize (int): Minibatch size
      update_interval (int): Model update interval in step
      n_times_update (int): Number of repetition of update
      episodic_update (bool): Use full episodes for update if set True
      episodic_update_len (int or None): Subsequences of this length are used
          for update if set int and episodic_update=True
class_docstr_tok: ["Object","that","handles","update","schedule","and","configurations",".","Args",":","replay_buffer","(","ReplayBuffer",")",":","Replay","buffer","update_func","(","callable",")",":","Callable","that","accepts","one","of","these",":","(","1",")","a","list","of","transition","dicts","(","if","episodic_update=False",")","(","2",")","a","list","of","lists","of","transition","dicts","(","if","episodic_update=True",")","replay_start_size","(","int",")",":","if","the","replay","buffer","'s","size","is","less","than","replay_start_size",",","skip","update","batchsize","(","int",")",":","Minibatch","size","update_interval","(","int",")",":","Model","update","interval","in","step","n_times_update","(","int",")",":","Number","of","repetition","of","update","episodic_update","(","bool",")",":","Use","full","episodes","for","update","if","set","True","episodic_update_len","(","int","or","None",")",":","Subsequences","of","this","length","are","used","for","update","if","set","int","and","episodic_update=True"]
docstr: Update the model if the condition is met.
  
  Args:
      iteration (int): Timestep.
  
  Returns:
      bool: True iff the condition was updated this time.
docstr_tok: ["Update","the","model","if","the","condition","is","met",".","Args",":","iteration","(","int",")",":","Timestep",".","Returns",":","bool",":","True","iff","the","condition","was","updated","this","time","."]
code: def update_if_necessary(self, iteration):
      """Update the model if the condition is met.
  
      Args:
          iteration (int): Timestep.
  
      Returns:
          bool: True iff the condition was updated this time.
      """
      if len(self.replay_buffer) < self.replay_start_size:
          return False
  
      if (
          self.episodic_update
          and self.replay_buffer.n_episodes < self.batchsize
      ):
          return False
  
      if iteration % self.update_interval != 0:
          return False
  
      for _ in range(self.n_times_update):
          if self.episodic_update:
              episodes = self.replay_buffer.sample_episodes(
                  self.batchsize, self.episodic_update_len
              )
              self.update_func(episodes)
          else:
              transitions = self.replay_buffer.sample(self.batchsize)
              self.update_func(transitions)
      return True
  
imports: from abc import ABCMeta, abstractmethod, abstractproperty
  from typing import Optional
  import numpy
  import torch
  from pfrl.utils.batch_states import batch_states
  from pfrl.utils.recurrent import concatenate_recurrent_states, flatten_sequences_time_first, recurrent_state_from_numpy
label_desc: Use image node_id 2 for calling the ReplayUpdater obj's underlying member method code with example usage: obj.update_if_necessary(iteration) and returns: True, False, False, False