class_docstr: Basic abstract activation generator for a model
class_docstr_tok: ["Basic","abstract","activation","generator","for","a","model"]
code: def process_and_load_activations(self, bottleneck_names, concepts):
      acts = {}
      if self.acts_dir and not tf.io.gfile.exists(self.acts_dir):
          tf.io.gfile.makedirs(self.acts_dir)
  
      for concept in concepts:
          if concept not in acts:
              acts[concept] = {}
          for bottleneck_name in bottleneck_names:
              acts_path = (
                  os.path.join(
                      self.acts_dir,
                      "acts_{}_{}".format(concept, bottleneck_name),
                  )
                  if self.acts_dir
                  else None
              )
              if acts_path and tf.io.gfile.exists(acts_path):
                  with tf.io.gfile.GFile(acts_path, "rb") as f:
                      acts[concept][bottleneck_name] = np.load(
                          f, allow_pickle=True
                      ).squeeze()
                      tf.compat.v1.logging.info(
                          "Loaded {} shape {}".format(
                              acts_path,
                              acts[concept][bottleneck_name].shape,
                          )
                      )
              else:
                  acts[concept][
                      bottleneck_name
                  ] = self.get_activations_for_concept(
                      concept, bottleneck_name
                  )
                  if acts_path:
                      tf.compat.v1.logging.info(
                          "{} does not exist, Making one...".format(
                              acts_path
                          )
                      )
                      tf.io.gfile.mkdir(os.path.dirname(acts_path))
                      with tf.io.gfile.GFile(acts_path, "w") as f:
                          np.save(
                              f,
                              acts[concept][bottleneck_name],
                              allow_pickle=False,
                          )
      return acts
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from abc import ABCMeta
  from abc import abstractmethod
  from multiprocessing import dummy
  import os
  import os.path
  import numpy
  import PIL.Image
  import six
  import tensorflow
label_desc: Use image node_id 6 for calling the ActivationGeneratorBase obj's underlying member method code with example usage: obj.process_and_load_activations(bottleneck_names, concepts) and returns: acts