class_docstr: Don't perform any test, but provide the function to test the
  Rop to class that inherit from it.
class_docstr_tok: ["Do","n't","perform","any","test",",","but","provide","the","function","to","test","the","Rop","to","class","that","inherit","from","it","."]
docstr: As check_mat_rop_lop, except the input is self.x which is a
  vector. The output is still a vector.
docstr_tok: ["As","check_mat_rop_lop",",","except","the","input","is","self.x","which","is","a","vector",".","The","output","is","still","a","vector","."]
code: def check_rop_lop(self, y, out_shape):
      """
      As check_mat_rop_lop, except the input is self.x which is a
      vector. The output is still a vector.
      """
      # TEST ROP
      vx = np.asarray(
          self.rng.uniform(size=self.in_shape), pytensor.config.floatX
      )
      vv = np.asarray(
          self.rng.uniform(size=self.in_shape), pytensor.config.floatX
      )
  
      yv = Rop(y, self.x, self.v)
      rop_f = function([self.x, self.v], yv, on_unused_input="ignore")
      J, _ = pytensor.scan(
          lambda i, y, x: grad(y[i], x),
          sequences=pt.arange(y.shape[0]),
          non_sequences=[y, self.x],
      )
      sy = dot(J, self.v)
  
      scan_f = function([self.x, self.v], sy, on_unused_input="ignore")
  
      v1 = rop_f(vx, vv)
      v2 = scan_f(vx, vv)
      assert np.allclose(v1, v2), f"ROP mismatch: {v1} {v2}"
  
      try:
          Rop(
              pytensor.clone_replace(
                  y, replace={self.x: break_op(self.x)}
              ),
              self.x,
              self.v,
          )
      except ValueError:
          pytest.skip(
              "Rop does not handle non-differentiable inputs "
              "correctly. Bug exposed by fixing Add.grad method."
          )
  
      vx = np.asarray(
          self.rng.uniform(size=self.in_shape), pytensor.config.floatX
      )
      vv = np.asarray(
          self.rng.uniform(size=out_shape), pytensor.config.floatX
      )
  
      yv = Lop(y, self.x, self.v)
      lop_f = function([self.x, self.v], yv, on_unused_input="ignore")
      J, _ = pytensor.scan(
          lambda i, y, x: grad(y[i], x),
          sequences=pt.arange(y.shape[0]),
          non_sequences=[y, self.x],
      )
      sy = dot(self.v, J)
  
      scan_f = function([self.x, self.v], sy)
  
      v1 = lop_f(vx, vv)
      v2 = scan_f(vx, vv)
      assert np.allclose(v1, v2), f"LOP mismatch: {v1} {v2}"
  
imports: import numpy
  import pytest
  import pytensor
  import pytensor.tensor
  from pytensor import function
  from pytensor.gradient import Lop, Rop, grad, grad_undefined
  from pytensor.graph.basic import Apply
  from pytensor.graph.op import Op
  from pytensor.tensor.math import argmax, dot
  from pytensor.tensor.math import max
  from pytensor.tensor.shape import unbroadcast
  from pytensor.tensor.type import matrix, vector
  from tests import unittest_tools
label_desc: Use image node_id 4 for calling the RopLopChecker obj's underlying member method code with example usage: obj.check_rop_lop(y, out_shape) without return types