code: def test_generic_dense_encoder(
      input_size: int, num_layers: int, output_size: int
  ):
      dense_encoder = DenseEncoder(
          input_size, num_layers=num_layers, output_size=output_size
      )
      inputs = torch.rand((10, input_size))
      outputs = dense_encoder(inputs)
      # Ensures output shape matches encoder expected output shape.
      assert (
          outputs[ENCODER_OUTPUT].shape[1:]
          == dense_encoder.output_shape
      )
  
imports: import pytest
  import torch
  from ludwig.constants import ENCODER_OUTPUT
  from ludwig.encoders.generic_encoders import DenseEncoder, PassthroughEncoder
label_desc: Use image node_id 2 for calling a global function with example usage: test_generic_dense_encoder(input_size, num_layers, output_size) without return types