class_docstr: Type specification for a `tf.sparse.SparseTensor`.
class_docstr_tok: ["Type","specification","for","a","`","tf.sparse.SparseTensor","`","."]
code: def _from_compatible_tensor_list(self, tensor_list):
      tensor_list = gen_sparse_ops.deserialize_sparse(
          tensor_list[0], self._dtype
      )
      indices, values, dense_shape = tensor_list
      rank = self._shape.ndims
      indices.set_shape([None, rank])
      # We restore the dense_shape from the SparseTypeSpec. This is necessary
      # for shape inference when using placeholder SparseTensors in function
      # tracing.
      if self._shape.is_fully_defined():
          dense_shape = ops.convert_to_tensor(
              self._shape, dtype=dtypes.int64, name="shape"
          )
      elif self._shape.rank is not None and any(
          dim.value is not None for dim in self._shape.dims
      ):
          pieces = array_ops_stack.unstack(
              dense_shape, num=self._shape.rank
          )
          for i, dim in enumerate(self._shape.dims):
              if dim.value is not None:
                  pieces[i] = constant_op.constant(
                      dim.value, dense_shape.dtype
                  )
          dense_shape = array_ops_stack.stack(pieces)
      else:
          dense_shape.set_shape([rank])
  
      return SparseTensor(indices, values, dense_shape)
  
imports: import collections
  import numpy
  from tensorflow.core.protobuf import struct_pb2
  from tensorflow.python import pywrap_tensorflow
  from tensorflow.python import tf2
  from tensorflow.python.framework import composite_tensor
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import override_binary_operator
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import tensor_spec
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.framework import type_spec
  from tensorflow.python.framework import type_spec_registry
  from tensorflow.python.ops import array_ops_stack
  from tensorflow.python.ops import gen_math_ops
  from tensorflow.python.ops import gen_sparse_ops
  from tensorflow.python.saved_model import nested_structure_coder
  from tensorflow.python.types import internal
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 11 for calling the SparseTensorSpec obj's underlying member method code with example usage: obj._from_compatible_tensor_list(tensor_list) and returns: SparseTensor