code: def sobol_sample(
      dim: types.IntTensor,
      num_results: types.IntTensor,
      sequence_indices: types.IntTensor = None,
      digital_shift: types.IntTensor = None,
      scrambling_matrices: types.IntTensor = None,
      apply_tent_transform: bool = False,
      validate_args: bool = False,
      dtype: tf.DType = None,
      name: str = None,
  ) -> types.RealTensor:
      r"""Samples points from the Sobol sequence.
  
      #### Examples
  
      ```python
      import tf_quant_finance as tff
  
      # Example: Sampling 1,000 points from the 2D Sobol sequence.
  
      dim = 2
      num_results = 1000
  
      tff.math.qmc.sobol_sample(dim, num_results)
      # ==> tf.Tensor([
      #             [0.,         0.        ],
      #             [0.5,        0.5       ],
      #             [0.25,       0.75      ],
      #             ...
      #             [0.65527344, 0.9736328 ],
      #             [0.40527344, 0.7236328 ],
      #             [0.90527344, 0.22363281],
      #         ], shape=(1000, 2), dtype=float32)
      ```
  
      Args:
        dim: Positive scalar `Tensor` of integers with rank 0. The event size of the
          sampled points.
        num_results: Positive scalar `Tensor` of integers with rank 0. The number of
          points to sample.
        sequence_indices: Optional positive scalar `Tensor` of integers with rank 1.
          The elements of the sequence to return specified by their position in the
          sequence.
          Default value: `None` which corresponds to the `[0, num_results)` range.
        digital_shift: Optional digital shift to be applied to all the points via a
          bitwise xor.
          Default value: `None`.
        scrambling_matrices: Positive scalar `Tensor` with the same `shape` and
          `dtype` as `generating_matrices`. Used to randomize `generating_matrices`.
          Default value: `None`.
        apply_tent_transform: Python `bool` indicating whether to apply a tent
          transform to the sampled points.
          Default value: `False`.
        validate_args: Python `bool` indicating whether to validate arguments.
          Default value: `False`.
        dtype: Optional `dtype`. The `dtype` of the output `Tensor` (either
          `float32` or `float64`).
          Default value: `None` which maps to `float32`.
        name: Python `str` name prefixed to ops created by this function.
          Default value: `None` which maps to `sobol_sample`.
  
      Returns:
        A `Tensor` of samples from  the Sobol sequence with `shape`
        `(num_samples, dim)` where `num_samples = min(num_results,
        size(sequence_indices))` and `dim = tf.shape(generating_matrices)[0]`.
      """
  
      with tf.name_scope(name or "sobol_sample"):
          dtype = dtype or tf.float32
  
          num_digits = tf.cast(
              tf.math.ceil(
                  utils.log2(tf.cast(num_results, dtype=tf.float32))
              ),
              tf.int32,
          )
  
          # shape: (dim, log_num_results)
          generating_matrices = sobol_generating_matrices(
              dim,
              num_results,
              num_digits,
              validate_args=validate_args,
              dtype=tf.int32,
          )
  
          if scrambling_matrices is not None:
              # shape: (dim, log_num_results)
              generating_matrices = (
                  digital_net.scramble_generating_matrices(
                      generating_matrices,
                      scrambling_matrices,
                      num_digits,
                      validate_args=validate_args,
                  )
              )
  
          # shape: (num_results, dim)
          return digital_net.digital_net_sample(
              generating_matrices,
              num_results,
              num_digits,
              sequence_indices=sequence_indices,
              digital_shift=digital_shift,
              apply_tent_transform=apply_tent_transform,
              validate_args=validate_args,
              dtype=dtype,
          )
  
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 1 for calling a global function with example usage: sobol_sample(dim, num_results, sequence_indices, digital_shift, scrambling_matrices, apply_tent_transform, validate_args, dtype, name) and returns: digital_net