class_docstr: Base class for op test that compares the output with NumPy
  implementation.
  
  It must be used in conjunction with `op_test` decorator.
  
  Examples:
  
  @op_utils.op_test(['native:0', 'cuda:0'])
  class test_tanh(op_utils.NumpyOpTest):
  
      def setup(self, float_dtype):
          self.dtype = dtype
  
      def generate_inputs(self):
          x = numpy.random.uniform(-1, 1, (2, 3)).astype(self.dtype)
          return x,
  
      def forward_xp(self, inputs, xp):
          x, = inputs
          return xp.tanh(x),
  
  In this example, `float_dtype` is a Pytest fixture for parameterizing
  floating-point dtypes (i.e. float16, float32, float64). As seen from
  this, arguments in the `setup` method are treated as Pytest fixtures.
  
  Test implementations must at least override the following methods:
    * `generate_inputs`: Generates inputs to the test target.
    * `forward_xp`: Forward implementation using both ChainerX and NumPy.
  
  It can have the same attributes as `chainer.testing.FunctionTestCase`.
  
  This test also compares strides of forward output arrays with NumPy
  outputs. Set ``check_numpy_strides_compliance`` attribute to ``False``
  to skip this check.
  
  Acceptable errors in forward computations can be configured with
  ``forward_accept_errors``. If both ChainerX/NumPy forward implementations
  raise one of those errors, the test will succeed and
  backward/double-backward tests will be skipped.
class_docstr_tok: ["Base","class","for","op","test","that","compares","the","output","with","NumPy","implementation",".","It","must","be","used","in","conjunction","with","`","op_test","`","decorator",".","Examples",":","@","op_utils.op_test","(","[","'native:0","'",",","'cuda:0","'","]",")","class","test_tanh","(","op_utils.NumpyOpTest",")",":","def","setup","(","self",",","float_dtype",")",":","self.dtype","=","dtype","def","generate_inputs","(","self",")",":","x","=","numpy.random.uniform","(","-1",",","1",",","(","2",",","3",")",")",".astype","(","self.dtype",")","return","x",",","def","forward_xp","(","self",",","inputs",",","xp",")",":","x",",","=","inputs","return","xp.tanh","(","x",")",",","In","this","example",",","`","float_dtype","`","is","a","Pytest","fixture","for","parameterizing","floating-point","dtypes","(","i.e",".","float16",",","float32",",","float64",")",".","As","seen","from","this",",","arguments","in","the","`","setup","`","method","are","treated","as","Pytest","fixtures",".","Test","implementations","must","at","least","override","the","following","methods",":","*","`","generate_inputs","`",":","Generates","inputs","to","the","test","target",".","*","`","forward_xp","`",":","Forward","implementation","using","both","ChainerX","and","NumPy",".","It","can","have","the","same","attributes","as","`","chainer.testing.FunctionTestCase","`",".","This","test","also","compares","strides","of","forward","output","arrays","with","NumPy","outputs",".","Set","``","check_numpy_strides_compliance","``","attribute","to","``","False","``","to","skip","this","check",".","Acceptable","errors","in","forward","computations","can","be","configured","with","``","forward_accept_errors","``",".","If","both","ChainerX\/NumPy","forward","implementations","raise","one","of","those","errors",",","the","test","will","succeed","and","backward\/double-backward","tests","will","be","skipped","."]
code: def forward_xp(self, inputs, xp):
      raise NotImplementedError(
          "Op test implementation must override `forward_xp`."
      )
  
imports: import inspect
  import sys
  import unittest
  import numpy
  import pytest
  import chainer
  import chainer.testing
  import chainerx
label_desc: Use image node_id 5 for calling the NumpyOpTest obj's underlying member method code with example usage: obj.forward_xp(inputs, xp) without return types