class_docstr: IntSparseTensorGenerator generates tf.sparse.SparseTensor with dtype in tf.int32 or tf.int64
class_docstr_tok: ["IntSparseTensorGenerator","generates","tf.sparse.SparseTensor","with","dtype","in","tf.int32","or","tf.int64"]
docstr: Create a new IntSparseTensorGenerator
  
  With tf.int32 dtype, the generated int range is between -2^31 to 2^31 - 1.
  With tf.int64 dtype, the generated int range is between -2^63 to 2^63 - 1.
  
  Args:
    spec: A tf.SparseTensorSpec that describes the output tensor.
    num_values: A value distribution or an int specifying number of non-zero values in the sparse tensor.
  
  Raises:
    TypeError: If dtype in spec is not tf.int32 or tf.int64.
docstr_tok: ["Create","a","new","IntSparseTensorGenerator","With","tf.int32","dtype",",","the","generated","int","range","is","between","-2^31","to","2^31","-","1",".","With","tf.int64","dtype",",","the","generated","int","range","is","between","-2^63","to","2^63","-","1",".","Args",":","spec",":","A","tf.SparseTensorSpec","that","describes","the","output","tensor",".","num_values",":","A","value","distribution","or","an","int","specifying","number","of","non-zero","values","in","the","sparse","tensor",".","Raises",":","TypeError",":","If","dtype","in","spec","is","not","tf.int32","or","tf.int64","."]
code: def __init__(self, spec, num_values):
      """Create a new IntSparseTensorGenerator
  
      With tf.int32 dtype, the generated int range is between -2^31 to 2^31 - 1.
      With tf.int64 dtype, the generated int range is between -2^63 to 2^63 - 1.
  
      Args:
        spec: A tf.SparseTensorSpec that describes the output tensor.
        num_values: A value distribution or an int specifying number of non-zero values in the sparse tensor.
  
      Raises:
        TypeError: If dtype in spec is not tf.int32 or tf.int64.
      """
      super().__init__(spec, num_values)
  
      if spec.dtype not in [tf.int32, tf.int64]:
          raise TypeError(
              "IntSparseTensorGenerator can only generate tf.sparse.SparseTensor with "
              f"dtype in tf.int32 or tf.int64 but found {spec.dtype}."
          )
  
imports: import enum
  import random
  import hashlib
  import numpy
  import tensorflow
  from tests.test_atds_avro.utils.generator.generator_base import Generator
  from tests.test_atds_avro.utils.hash_util import int_to_bytes
label_desc: Use image node_id 1 to create a new IntSparseTensorGenerator object from inherited base classes: SparseTensorGeneratorBase with example: obj = IntSparseTensorGenerator(spec, num_values)