class_docstr: Enables different values in a categorical features to have different embeddings.
class_docstr_tok: ["Enables","different","values","in","a","categorical","features","to","have","different","embeddings","."]
code: def forward(self, x: Dict[str, Any]) -> torch.Tensor:
      assert (
          "continuous" in x or "categorical" in x
      ), "x must contain either continuous and categorical features"
      # (B, N)
      continuous_data, categorical_data = x.get(
          "continuous", torch.empty(0, 0)
      ), x.get("categorical", torch.empty(0, 0))
      assert categorical_data.shape[1] == len(
          self.cat_embedding_layers
      ), "categorical_data must have same number of columns as categorical embedding layers"
      assert (
          continuous_data.shape[1] == self.continuous_dim
      ), "continuous_data must have same number of columns as continuous dim"
      embed = None
      if continuous_data.shape[1] > 0:
          if self.batch_norm_continuous_input:
              embed = self.normalizing_batch_norm(continuous_data)
          else:
              embed = continuous_data
          # (B, N, C)
      if categorical_data.shape[1] > 0:
          categorical_embed = torch.cat(
              [
                  embedding_layer(categorical_data[:, i])
                  for i, embedding_layer in enumerate(
                      self.cat_embedding_layers
                  )
              ],
              dim=1,
          )
          # (B, N, C + C)
          if embed is None:
              embed = categorical_embed
          else:
              embed = torch.cat([embed, categorical_embed], dim=1)
      if self.embd_dropout is not None:
          embed = self.embd_dropout(embed)
      return embed
  
imports: import math
  from functools import partial
  from typing import Any, Dict, List, Optional, Tuple
  import torch
  from torch import nn
  from pytorch_tabular.models.common.layers.batch_norm import BatchNorm1d
  from pytorch_tabular.utils import _initialize_kaiming
label_desc: Use image node_id 2 for calling the Embedding1dLayer obj's underlying member method code with example usage: obj.forward(x) and returns: embed