class_docstr: Test for tfp.math.trapz.
class_docstr_tok: ["Test","for","tfp.math.trapz","."]
code: def test_against_numpy(self, data):
      dtype = data.draw(hps.sampled_from([np.float32, np.float64]))
      shp = (
          data.draw(hps.integers(5, 10)),
          data.draw(hps.integers(5, 10)),
      )
      axis = data.draw(hps.integers(0, len(shp) - 1))
      y = data.draw(
          tfp_hps.constrained_tensors(tfp_hps.identity_fn, shp, dtype)
      )
      x_dx = data.draw(hps.sampled_from(["x", "dx", None]))
      if x_dx is None:
          x = None
          dx = None
      elif x_dx == "dx":
          x = None
          dx = data.draw(hps.floats(0.1, 10))
      else:
          x = data.draw(
              tfp_hps.constrained_tensors(
                  tfp_hps.identity_fn, shp, dtype
              )
          )
          dx = None
      np_soln = np.trapz(
          self.evaluate(y),
          x=self.evaluate(x)
          if x is not None
          else None,  # cannot evaluate(None)
          dx=dx or 1.0,  # numpy default is 1.0
          axis=axis,
      )
      tf_soln = integration.trapz(y, x, dx, axis)
      self.assertAllClose(np_soln, tf_soln)
  
imports: import hypothesis
  from hypothesis import strategies
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import hypothesis_testlib
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import integration
label_desc: Use image node_id 14 for calling the TrapzTest obj's underlying member method code with example usage: obj.test_against_numpy(data) without return types