code: def interpolate_vertex_attribute(
      attribute: tf.Tensor,
      framebuffer: fb.Framebuffer,
      background_value: Optional[
          Union[tf.Tensor, Iterable[float]]
      ] = None,
  ) -> fb.RasterizedAttribute:
      """Interpolate a single vertex attribute across the input framebuffer.
  
      Args:
        attribute: 2-D or 3-D vertex attribute Tensor with shape [batch,
          num_vertices, num_channels] or [num_vertices, num_channels].
        framebuffer: Framebuffer to interpolate across. Expected to contain
          barycentrics, vertex_ids, and foreground_mask.
        background_value: 1-D Tensor (or convertible value) with shape
          [num_channels] containing the value to use for background pixels. If None,
          defaults to zero.
  
      Returns:
        A RasterizedAttribute containing the per-pixel interpolated values.
      """
      vertex_ids = tf.reshape(
          framebuffer.vertex_ids,
          [framebuffer.batch_size, framebuffer.pixel_count, 3],
      )
  
      num_channels = tf.compat.dimension_value(tf.shape(attribute)[-1])
  
      # Creates indices with each pixel's clip-space triangle's extrema (the pixel's
      # 'corner points') ids to look up the attributes for each pixel's triangle.
      # Handles batched or unbatched attributes. In either case, corner_attribute
      # will be shaped [batch_size, pixel_count, 3, num_channels] (with
      # batch_size = 1 if input is unbatched).
      if len(attribute.shape) == 3:
          corner_attribute = tf.gather(
              attribute, vertex_ids, batch_dims=1
          )
      else:
          vertex_ids = tf.reshape(vertex_ids, (-1, 3))
          corner_attribute = tf.gather(
              attribute, vertex_ids, batch_dims=0
          )
          corner_attribute = tf.reshape(
              corner_attribute,
              (
                  framebuffer.batch_size,
                  framebuffer.pixel_count,
                  3,
                  num_channels,
              ),
          )
  
      # Computes the pixel attributes by interpolating the known attributes at the
      # corner points of the triangle interpolated with the barycentric
      # coordinates.
      reshaped_barycentrics = tf.reshape(
          framebuffer.barycentrics.value,
          (framebuffer.batch_size, framebuffer.pixel_count, 3, 1),
      )
      weighted_vertex_attribute = tf.multiply(
          corner_attribute, reshaped_barycentrics
      )
      summed_attribute = tf.reduce_sum(
          weighted_vertex_attribute, axis=2
      )
      if framebuffer.is_multi_layer:
          out_shape = (
              framebuffer.batch_size,
              framebuffer.num_layers,
              framebuffer.height,
              framebuffer.width,
              num_channels,
          )
      else:
          out_shape = (
              framebuffer.batch_size,
              framebuffer.height,
              framebuffer.width,
              num_channels,
          )
  
      attribute_image = tf.reshape(summed_attribute, out_shape)
      if background_value is None:
          background_value = tf.zeros(
              (num_channels), dtype=attribute.dtype
          )
      else:
          background_value = tf.convert_to_tensor(
              background_value, dtype=attribute.dtype
          )
      attribute_image = (
          framebuffer.foreground_mask * attribute_image
          + framebuffer.background_mask * background_value
      )
      return fb.RasterizedAttribute(
          value=attribute_image, d_dx=None, d_dy=None
      )
  
label_desc: Use image node_id 1 for calling a global function with example usage: interpolate_vertex_attribute(attribute, framebuffer, background_value) and returns: fb