code: def sobol_generating_matrices(
      dim: types.IntTensor,
      num_results: types.IntTensor,
      num_digits: types.IntTensor,
      validate_args: bool = False,
      dtype: tf.DType = None,
      name: str = None,
  ) -> types.IntTensor:
      r"""Returns Sobol generating matrices.
  
      #### Examples
  
      ```python
      import tf_quant_finance as tff
  
      # Example: Creating the 4D Sobol generating matrices.
  
      dim = 4
      num_results = 500
      num_digits = 9
  
      tff.math.qmc.sobol_generating_matrices(dim, num_results, num_digits)
      # ==> tf.Tensor([
      #             [256, 128,  64,  32,  16,   8,   4,   2,   1],
      #             [256, 384, 320, 480, 272, 408, 340, 510, 257],
      #             [256, 384, 192, 288, 464, 184, 284, 394, 209],
      #             [256, 384,  64, 160, 496, 232, 324, 294, 433],
      #         ], shape=(4, 9), dtype=int32)
      ```
  
      Args:
        dim: Positive scalar `Tensor` of integers with rank 0. The event size of
          points which can be sampled from the resulting generating matrices.
        num_results: Positive scalar `Tensor` of integers with rank 0. The maximum
          number of points which can be sampled from the resulting generating
          matrices.
        num_digits: Positive scalar `Tensor` of integers with rank 0. The base-2
          precision of points which can be sampled from the resulting generating
          matrices.
        validate_args: Python `bool` indicating whether to validate arguments.
          Default value: `False`.
        dtype: Optional `dtype`. The `dtype` of the output `Tensor` (either a signed
          or unsigned integer `dtype`).
          Default value: `None` which maps to `int32`.
        name: Python `str` name prefixed to ops created by this function.
          Default value: `None` which maps to `sobol_generating_matrices`.
  
      Returns:
        A scalar `Tensor` with shape `(dim, log_num_results)` where
        `log_num_results = ceil(log2(num_results))`.
      """
  
      with tf.name_scope(name or "sobol_generating_matrices"):
          dtype = dtype or tf.int32
  
          dim = tf.convert_to_tensor(dim, dtype=dtype, name="dim")
          num_results = tf.convert_to_tensor(
              num_results, dtype=dtype, name="num_results"
          )
          num_digits = tf.convert_to_tensor(
              num_digits, dtype=dtype, name="num_digits"
          )
  
          log_num_results = tf.cast(
              tf.math.ceil(
                  utils.log2(tf.cast(num_results, dtype=tf.float32))
              ),
              dtype=dtype,
          )
  
          control_deps = []
          if validate_args:
              control_deps.append(
                  tf.debugging.assert_positive(
                      dim, message="dim must be positive"
                  )
              )
              control_deps.append(
                  tf.debugging.assert_positive(
                      num_results,
                      message="num_results must be positive",
                  )
              )
              control_deps.append(
                  tf.debugging.assert_positive(
                      num_digits, message="num_digits must be positive"
                  )
              )
              control_deps.append(
                  tf.debugging.assert_less(
                      log_num_results,
                      tf.constant(32, dtype=dtype),
                      message="log2(num_results) must be less than 32",
                  )
              )
  
          with tf.control_dependencies(control_deps):
              # shape: (1, log_num_results)
              identity = _identity_matrix(
                  log_num_results, num_digits, dtype=dtype
              )
              # shape: (dim - 1, log_num_results)
              matrices = _sobol_generating_matrices(
                  dim - 1, log_num_results, num_digits, dtype=dtype
              )
              # shape: (dim, log_num_results)
              return tf.concat((identity, matrices), axis=0)
  
file_path: tf-quant-finance/tf_quant_finance/math/qmc/sobol.py
imports: import tensorflow.compat.v2
  from tf_quant_finance import types
  from tf_quant_finance.math.qmc import digital_net
  from tf_quant_finance.math.qmc import utils
  from tf_quant_finance.math.random_ops import sobol
label_desc: Use image node_id 2 for calling a global function with example usage: sobol_generating_matrices(dim, num_results, num_digits, validate_args, dtype, name) and returns: tf