code: def _concat_inputs_with_latents(
      Z: tf.Tensor, X: TensorType
  ) -> TensorType:
      """
      Transforms a dataset X from category space into the latent space.
  
      :param Z: Z is a tensor whose entries are the latent space values of the relevant label
          i.e. Z[3] is the value of label 3.
          [num_labels]
      :param X: X is the input data.  The last column should contain the labels as integers.
          [..., N, D+1]
      :return: [..., N, D + label_dim]
      """
      labels = X[..., -1]
      latent_values = latent_from_labels(Z, labels)
  
      return tf.concat([X[..., :-1], latent_values], axis=-1)
  
file_path: GPflow/gpflow/kernels/categorical.py
imports: from typing import Any, Optional
  import numpy
  import tensorflow
  from ..None import default_int, set_trainable
  from ..base import Parameter, TensorType
  from .None import Kernel
label_desc: Use image node_id 2 for calling a global function with example usage: _concat_inputs_with_latents(Z, X) and returns: tf