docstr: Tests for using different names in feature columns vs features.
docstr_tok: ["Tests","for","using","different","names","in","feature","columns","vs","features","."]
code: def test_encode_listwise_features_renaming(self):
      """Tests for using different names in feature columns vs features."""
      # Batch size = 2, list_size = 2.
      features = {
          "query_length": tf.convert_to_tensor(value=[[1], [2]]),
          "utility": tf.convert_to_tensor(
              value=[[[1.0], [0.0]], [[0.0], [1.0]]]
          ),
          "unigrams": tf.SparseTensor(
              indices=[[0, 0, 0], [0, 1, 0], [1, 0, 0], [1, 1, 0]],
              values=[
                  "ranking",
                  "regression",
                  "classification",
                  "ordinal",
              ],
              dense_shape=[2, 2, 1],
          ),
      }
      context_feature_columns = {
          "query_length": feature_column.numeric_column(
              "query_length",
              shape=(1,),
              default_value=0,
              dtype=tf.int64,
          )
      }
      example_feature_columns = {
          "utility_renamed": feature_column.numeric_column(
              "utility", shape=(1,), default_value=0.0, dtype=tf.float32
          ),
          "unigrams_renamed": feature_column.embedding_column(
              feature_column.categorical_column_with_vocabulary_list(
                  "unigrams",
                  vocabulary_list=[
                      "ranking",
                      "regression",
                      "classification",
                      "ordinal",
                  ],
              ),
              dimension=10,
          ),
      }
  
      (
          context_features,
          example_features,
      ) = feature_lib.encode_listwise_features(
          features,
          input_size=2,
          context_feature_columns=context_feature_columns,
          example_feature_columns=example_feature_columns,
      )
      self.assertAllEqual(["query_length"], sorted(context_features))
      self.assertAllEqual(
          ["unigrams_renamed", "utility_renamed"],
          sorted(example_features),
      )
      self.assertAllEqual(
          [2, 2, 10],
          example_features["unigrams_renamed"].get_shape().as_list(),
      )
      self.assertAllEqual([[1], [2]], context_features["query_length"])
      self.assertAllEqual(
          [[[1.0], [0.0]], [[0.0], [1.0]]],
          example_features["utility_renamed"],
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow import estimator
  from google.protobuf import text_format
  from tensorflow.python.feature_column import feature_column_lib
  from tensorflow_ranking.python import feature
label_desc: Use image node_id 6 for calling the FeatureLibTest obj's underlying member method code with example usage: obj.test_encode_listwise_features_renaming() without return types