code: def _ragged_tensor_from_variant_grad(op, *grads):
      """Gradient for RaggedTensorFromVariant op."""
  
      variant_rank = op.inputs[0].shape.rank
      if variant_rank == 0:
          batched_input = False
      elif variant_rank == 1:
          batched_input = True
      elif variant_rank is None:
          batched_input = op.get_attr("output_ragged_rank") > 0
      else:
          # TODO(edloper): Add a batch_dims argument to RaggedTensorToVariant, so
          # we can support this.
          raise ValueError(
              "Unable to compute gradient: RaggedTensorToVariant "
              "can currently only generate 0D or 1D output."
          )
      return [
          gen_ragged_conversion_ops.ragged_tensor_to_variant(
              rt_nested_splits=op.outputs[:-1],
              rt_dense_values=grads[-1],
              batched_input=batched_input,
          )
      ]
  
file_path: tensorflow-upstream/tensorflow/python/ops/ragged/ragged_conversion_ops.py
imports: from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import indexed_slices
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_ragged_conversion_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops.ragged import ragged_tensor
label_desc: Use image node_id 8 for calling a global function with example usage: _ragged_tensor_from_variant_grad(op) and returns: list