code: def _sparsify(self, x, indices_dtype=np.int64):
      x[x < 0.5] = 0
  
      non_zero = np.where(x)
      x_indices = np.vstack(non_zero).astype(indices_dtype).T
      x_values = x[non_zero]
      x_shape = x.shape
  
      return sparse_tensor.SparseTensor(
          indices=x_indices, values=x_values, dense_shape=x_shape
      ), len(x_values)
  
file_path: tensorflow-upstream/tensorflow/python/kernel_tests/sparse_ops/sparse_tensor_dense_matmul_grad_test.py
imports: import numpy
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import gradient_checker
  from tensorflow.python.ops import sparse_ops
  import tensorflow.python.ops.sparse_grad
  from tensorflow.python.platform import test
label_desc: Use image node_id 1 for calling the SparseTensorDenseMatMulGradientTest obj's underlying member method code with example usage: obj._sparsify(x, indices_dtype) and returns: sparse_tensor,  len