code: def remove_padding_from_sc(
      value_in_checkpoint: tensor.Tensor,
      variable_shape: tuple[int, int],
  ) -> tensor.Tensor:
      """Removes padding, if any, from sparsecore checkpoint.
  
      Args:
        value_in_checkpoint: input tensor value, usually from checkpoint.
        variable_shape: Expected shape of tensor after removing padding.
  
      Returns:
        A slice of the input tensor to match the variable_shape if the
        variable shape is a valid slice if the input tensor.
      """
      checkpoint_value_shape = value_in_checkpoint.shape.as_list()
      # If the checkpoint shape is at least the size of the variable, we conclude
      # that the extra rows and cols must be padding.
      is_init_value_padded = all(
          [
              i >= j
              for i, j in zip(checkpoint_value_shape, variable_shape)
          ]
      )
      if not is_init_value_padded:
          return value_in_checkpoint
      # checkpoint has padding so we can remove it.
      begin = [0] * len(checkpoint_value_shape)
      return array_ops.slice(
          value_in_checkpoint, begin=begin, size=variable_shape
      )
  
imports: import functools
  from typing import Any, Dict
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework.constant_op import constant
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import manip_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.trackable import base
label_desc: Use image node_id 2 for calling a global function with example usage: remove_padding_from_sc(value_in_checkpoint, variable_shape) and returns: array_ops, value_in_checkpoint