class_docstr: A keras Layer, which intercepts its inputs and stored them as pickled.
class_docstr_tok: ["A","keras","Layer",",","which","intercepts","its","inputs","and","stored","them","as","pickled","."]
docstr: The actual spy operation: Store inputs in internal_kv.
docstr_tok: ["The","actual","spy","operation",":","Store","inputs","in","internal_kv","."]
code: def spy(inputs, seq_lens, h_in, c_in, h_out, c_out):
      """The actual spy operation: Store inputs in internal_kv."""
  
      if len(inputs) == 1:
          # don't capture inference inputs
          return SpyLayer.output
      # TF runs this function in an isolated context, so we have to use
      # redis to communicate back to our suite
      ray.experimental.internal_kv._internal_kv_put(
          "rnn_spy_in_{}".format(RNNSpyModel.capture_index),
          pickle.dumps(
              {
                  "sequences": inputs,
                  "seq_lens": seq_lens,
                  "state_in": [h_in, c_in],
                  "state_out": [h_out, c_out],
              }
          ),
          overwrite=True,
      )
      RNNSpyModel.capture_index += 1
      return SpyLayer.output
  
file_path: ray/python/ray/rllib/examples/models/rnn_spy_model.py
imports: import numpy
  import pickle
  import ray
  from ray.rllib.models.modelv2 import ModelV2
  from ray.rllib.models.tf.misc import normc_initializer
  from ray.rllib.models.tf.recurrent_net import RecurrentNetwork
  from ray.rllib.utils.annotations import override
  from ray.rllib.utils.framework import try_import_tf
label_desc: Use image node_id 3 for calling the SpyLayer obj's underlying member method code with example usage: obj.spy(inputs, seq_lens, h_in, c_in, h_out, c_out) and returns: SpyLayer, SpyLayer