code: def activations_keras(model, X, fmt="longform", plot="boxplot"):
      # test layer by layer on data
      if fmt == "longform":
          # return long form pandas dataframe for
          # seaborn boxplot
          data = {"x": [], "weight": []}
      elif fmt == "summary":
          # return summary statistics for matplotlib.axes.Axes.bxp
          # or histogram bin edges and heights
          data = []
      outputs = _get_outputs(
          [
              layer
              for layer in model.layers
              if not isinstance(layer, keras.layers.InputLayer)
          ],
          X,
          model.input,
      )
      outputs = dict(
          zip(
              [
                  layer.name
                  for layer in model.layers
                  if not isinstance(layer, keras.layers.InputLayer)
              ],
              outputs,
          )
      )
      for layer_name, y in outputs.items():
          print(f"   {layer_name}")
          y = y.flatten()
          y = abs(y[y != 0])
          if len(y) == 0:
              print(
                  f"Activations for {layer_name} are only zeros, ignoring."
              )
              continue
          if fmt == "longform":
              data["x"].extend(y.tolist())
              data["weight"].extend([layer_name for i in range(len(y))])
          elif fmt == "summary":
              data.append(array_to_summary(y, fmt=plot))
              data[-1]["weight"] = layer_name
  
      if fmt == "longform":
          data = pandas.DataFrame(data)
      return data
  
imports: import json
  import os
  import shutil
  import uuid
  from collections import defaultdict
  import matplotlib.pyplot
  import numpy
  import pandas
  import seaborn
  from hls4ml.model.graph import ModelGraph
  from hls4ml.model.layers import GRU, LSTM, SeparableConv1D, SeparableConv2D
label_desc: Use image node_id 16 for calling a global function with example usage: activations_keras(model, X, fmt, plot) and returns: data