class_docstr: Model allows using pre-trained models.
class_docstr_tok: ["Model","allows","using","pre-trained","models","."]
docstr: Collect center activtions of a layer over an n-dimensional array of images.
  
  Note: this is mostly intended for large synthetic families of images, where
    you can cheaply generate them in Python. For collecting activations over,
    say, ImageNet, there will be better workflows based on various dataset APIs
    in TensorFlow.
  
  Args:
    layer: layer (in model) for activtions to be collected from.
    examples: A (potentially n-dimensional) array of images. Can be any nested
      iterable object, including a generator, as long as the inner most objects
      are a numpy array with at least 3 dimensions (image X, Y, channels=3).
    batch_size: How many images should be processed at once?
    dtype: determines dtype of returned data (defaults to model activation
      dtype). Can be used to make function memory efficient.
    ind_shape: Shape that the index (non-image) dimensions of examples. Makes
      code much more memory efficient if examples is not a numpy array.
  
  Memory efficeincy:
    Have examples be a generator rather than an array of images; this allows
    them to be lazily generated and not all stored in memory at once. Also
    use ind_shape so that activations can be stored in an efficient data
    structure. If you still have memory problems, dtype="float16" can probably
    get you another 2x.
  
  Returns:
    A numpy array of shape [ind1, ind2, ..., layer_channels]
docstr_tok: ["Collect","center","activtions","of","a","layer","over","an","n-dimensional","array","of","images",".","Note",":","this","is","mostly","intended","for","large","synthetic","families","of","images",",","where","you","can","cheaply","generate","them","in","Python",".","For","collecting","activations","over",",","say",",","ImageNet",",","there","will","be","better","workflows","based","on","various","dataset","APIs","in","TensorFlow",".","Args",":","layer",":","layer","(","in","model",")","for","activtions","to","be","collected","from",".","examples",":","A","(","potentially","n-dimensional",")","array","of","images",".","Can","be","any","nested","iterable","object",",","including","a","generator",",","as","long","as","the","inner","most","objects","are","a","numpy","array","with","at","least","3","dimensions","(","image","X",",","Y",",","channels=3",")",".","batch_size",":","How","many","images","should","be","processed","at","once","?","dtype",":","determines","dtype","of","returned","data","(","defaults","to","model","activation","dtype",")",".","Can","be","used","to","make","function","memory","efficient",".","ind_shape",":","Shape","that","the","index","(","non-image",")","dimensions","of","examples",".","Makes","code","much","more","memory","efficient","if","examples","is","not","a","numpy","array",".","Memory","efficeincy",":","Have","examples","be","a","generator","rather","than","an","array","of","images",";","this","allows","them","to","be","lazily","generated","and","not","all","stored","in","memory","at","once",".","Also","use","ind_shape","so","that","activations","can","be","stored","in","an","efficient","data","structure",".","If","you","still","have","memory","problems",",","dtype=","''","float16","''","can","probably","get","you","another","2x",".","Returns",":","A","numpy","array","of","shape","[","ind1",",","ind2",",","...",",","layer_channels","]"]
code: def get_activations(
      self,
      layer,
      examples,
      batch_size=64,
      dtype=None,
      ind_shape=None,
      center_only=False,
  ):
      """Collect center activtions of a layer over an n-dimensional array of images.
  
      Note: this is mostly intended for large synthetic families of images, where
        you can cheaply generate them in Python. For collecting activations over,
        say, ImageNet, there will be better workflows based on various dataset APIs
        in TensorFlow.
  
      Args:
        layer: layer (in model) for activtions to be collected from.
        examples: A (potentially n-dimensional) array of images. Can be any nested
          iterable object, including a generator, as long as the inner most objects
          are a numpy array with at least 3 dimensions (image X, Y, channels=3).
        batch_size: How many images should be processed at once?
        dtype: determines dtype of returned data (defaults to model activation
          dtype). Can be used to make function memory efficient.
        ind_shape: Shape that the index (non-image) dimensions of examples. Makes
          code much more memory efficient if examples is not a numpy array.
  
      Memory efficeincy:
        Have examples be a generator rather than an array of images; this allows
        them to be lazily generated and not all stored in memory at once. Also
        use ind_shape so that activations can be stored in an efficient data
        structure. If you still have memory problems, dtype="float16" can probably
        get you another 2x.
  
      Returns:
        A numpy array of shape [ind1, ind2, ..., layer_channels]
      """
  
      return _get_activations(
          self,
          layer,
          examples,
          batch_size=batch_size,
          dtype=dtype,
          ind_shape=ind_shape,
          center_only=center_only,
      )
  
imports: from __future__ import absolute_import, division, print_function
  from os import path
  import warnings
  import logging
  from itertools import chain
  import tensorflow
  import numpy
  from lucid.modelzoo import util
  from lucid.modelzoo.aligned_activations import get_aligned_activations
  from lucid.modelzoo.get_activations import get_activations
  from lucid.misc.io import load, save
  import lucid.misc.io.showing
label_desc: Use image node_id 24 for calling the Model obj's underlying member method code with example usage: obj.get_activations(layer, examples, batch_size, dtype, ind_shape, center_only) and returns: _get_activations