docstr: Test one of many possible errors in shape of inputs.
docstr_tok: ["Test","one","of","many","possible","errors","in","shape","of","inputs","."]
code: def test_inconsistent_rank_inputs_for_importance_weights(self):
      """Test one of many possible errors in shape of inputs."""
      for fw in framework_iterator(
          frameworks=("torch", "tf"), session=True
      ):
          vtrace = vtrace_tf if fw != "torch" else vtrace_torch
          if fw == "tf":
              inputs_ = {
                  "log_rhos": tf1.placeholder(
                      dtype=tf.float32, shape=[None, None, 1]
                  ),
                  "discounts": tf1.placeholder(
                      dtype=tf.float32, shape=[None, None, 1]
                  ),
                  "rewards": tf1.placeholder(
                      dtype=tf.float32, shape=[None, None, 42]
                  ),
                  "values": tf1.placeholder(
                      dtype=tf.float32, shape=[None, None, 42]
                  ),
                  # Should be [None, 42].
                  "bootstrap_value": tf1.placeholder(
                      dtype=tf.float32, shape=[None]
                  ),
              }
          else:
              inputs_ = {
                  "log_rhos": Box(-1.0, 1.0, (7, 15, 1)).sample(),
                  "discounts": Box(-1.0, 1.0, (7, 15, 1)).sample(),
                  "rewards": Box(-1.0, 1.0, (7, 15, 42)).sample(),
                  "values": Box(-1.0, 1.0, (7, 15, 42)).sample(),
                  # Should be [15, 42].
                  "bootstrap_value": Box(-1.0, 1.0, (7,)).sample(),
              }
          with self.assertRaisesRegex(
              (ValueError, AssertionError), "must have rank 2"
          ):
              vtrace.from_importance_weights(**inputs_)
  
file_path: ray/rllib/algorithms/impala/tests/test_vtrace.py
imports: from gymnasium.spaces import Box
  import numpy
  import unittest
  from ray.rllib.algorithms.impala import vtrace_tf
  from ray.rllib.algorithms.impala import vtrace_torch
  from ray.rllib.utils.framework import try_import_tf, try_import_torch
  from ray.rllib.utils.numpy import softmax
  from ray.rllib.utils.test_utils import check, framework_iterator
label_desc: Use image node_id 4 for calling the VtraceTest obj's underlying member method code with example usage: obj.test_inconsistent_rank_inputs_for_importance_weights() without return types