code: def test_digital_net_sample(self):
      dim = 5
      num_results = 29
      num_digits = 5  # ceil(log2(num_results))
  
      for dtype in [tf.int32, tf.int64]:
          expected = tf.constant(
              [
                  [0.00000, 0.00000, 0.00000, 0.00000, 0.00000],
                  [0.50000, 0.50000, 0.50000, 0.50000, 0.50000],
                  [0.25000, 0.75000, 0.75000, 0.75000, 0.25000],
                  [0.75000, 0.25000, 0.25000, 0.25000, 0.75000],
                  [0.12500, 0.62500, 0.37500, 0.12500, 0.12500],
                  [0.62500, 0.12500, 0.87500, 0.62500, 0.62500],
                  [0.37500, 0.37500, 0.62500, 0.87500, 0.37500],
                  [0.87500, 0.87500, 0.12500, 0.37500, 0.87500],
                  [0.06250, 0.93750, 0.56250, 0.31250, 0.68750],
                  [0.56250, 0.43750, 0.06250, 0.81250, 0.18750],
                  [0.31250, 0.18750, 0.31250, 0.56250, 0.93750],
                  [0.81250, 0.68750, 0.81250, 0.06250, 0.43750],
                  [0.18750, 0.31250, 0.93750, 0.43750, 0.56250],
                  [0.68750, 0.81250, 0.43750, 0.93750, 0.06250],
                  [0.43750, 0.56250, 0.18750, 0.68750, 0.81250],
                  [0.93750, 0.06250, 0.68750, 0.18750, 0.31250],
                  [0.03125, 0.53125, 0.90625, 0.96875, 0.96875],
                  [0.53125, 0.03125, 0.40625, 0.46875, 0.46875],
                  [0.28125, 0.28125, 0.15625, 0.21875, 0.71875],
                  [0.78125, 0.78125, 0.65625, 0.71875, 0.21875],
                  [0.15625, 0.15625, 0.53125, 0.84375, 0.84375],
                  [0.65625, 0.65625, 0.03125, 0.34375, 0.34375],
                  [0.40625, 0.90625, 0.28125, 0.09375, 0.59375],
                  [0.90625, 0.40625, 0.78125, 0.59375, 0.09375],
                  [0.09375, 0.46875, 0.46875, 0.65625, 0.28125],
                  [0.59375, 0.96875, 0.96875, 0.15625, 0.78125],
                  [0.34375, 0.71875, 0.71875, 0.40625, 0.03125],
                  [0.84375, 0.21875, 0.21875, 0.90625, 0.53125],
                  [0.21875, 0.84375, 0.09375, 0.53125, 0.40625],
              ],
              dtype=tf.float32,
          )
  
          actual = qmc.digital_net_sample(
              qmc.sobol_generating_matrices(
                  dim, num_results, num_digits, dtype=dtype
              ),
              num_results,
              num_digits,
              validate_args=True,
          )
  
          with self.subTest("Values"):
              self.assertAllClose(
                  self.evaluate(actual),
                  self.evaluate(expected),
                  rtol=1e-6,
              )
          with self.subTest("DType"):
              self.assertEqual(actual.dtype, expected.dtype)
  
file_path: tf-quant-finance/tf_quant_finance/math/qmc/digital_net_test.py
imports: import tensorflow.compat.v2
  import tf_quant_finance
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 5 for calling the DigitalNetTest obj's underlying member method code with example usage: obj.test_digital_net_sample() without return types