docstr: :param inputs: The inputs fed into the encoder.
         Shape: [batch, 1] or [batch]
docstr_tok: [":","param","inputs",":","The","inputs","fed","into","the","encoder",".","Shape",":","[","batch",",","1","]","or","[","batch","]"]
code: def forward(
      self, inputs: torch.Tensor, mask: Optional[torch.Tensor] = None
  ) -> EncoderOutputDict:
      """
      :param inputs: The inputs fed into the encoder.
             Shape: [batch, 1] or [batch]
      """
      t = inputs.reshape(-1).long()
      # the output of this must be a float so that it can be concatenated with other
      # encoder outputs and passed to dense layers in the combiner, decoder, etc.
      outputs = self.identity(
          torch.nn.functional.one_hot(
              t, num_classes=self.vocab_size
          ).float()
      )
      return {"encoder_output": outputs}
  
imports: import logging
  from typing import Dict, List, Optional, Type, Union
  import torch
  from torch import nn
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.constants import CATEGORY, ENCODER_OUTPUT
  from ludwig.encoders.base import Encoder
  from ludwig.encoders.registry import register_encoder
  from ludwig.encoders.types import EncoderOutputDict
  from ludwig.modules.embedding_modules import Embed
  from ludwig.schema.encoders.base import BaseEncoderConfig
  from ludwig.schema.encoders.category_encoders import CategoricalEmbedConfig, CategoricalOneHotEncoderConfig, CategoricalPassthroughEncoderConfig, CategoricalSparseConfig
label_desc: Use image node_id 2 for calling the CategoricalOneHotEncoder obj's underlying member method code with example usage: obj.forward(inputs, mask) and returns: dict