code: def test_bag_input_feature(bag_config: Dict, encoder: str) -> None:
      bag_config[ENCODER].update({"type": encoder})
      bag_config, _ = load_config_with_kwargs(
          BagInputFeatureConfig, bag_config
      )
      bag_input_feature = BagInputFeature(bag_config).to(DEVICE)
      bag_tensor = torch.randn(
          [BATCH_SIZE, SEQ_SIZE, BAG_W_SIZE], dtype=torch.float32
      ).to(DEVICE)
      encoder_output = bag_input_feature(bag_tensor)
      assert (
          encoder_output[ENCODER_OUTPUT].shape[1:][1:]
          == bag_input_feature.output_shape
      )
  
file_path: ludwig/tests/ludwig/features/test_bag_feature.py
imports: from random import choice
  from string import ascii_lowercase, ascii_uppercase, digits
  from typing import Dict
  import pytest
  import torch
  from ludwig.constants import ENCODER, ENCODER_OUTPUT
  from ludwig.features.bag_feature import BagInputFeature
  from ludwig.schema.features.bag_feature import BagInputFeatureConfig
  from ludwig.schema.utils import load_config_with_kwargs
  from ludwig.utils.torch_utils import get_torch_device
label_desc: Use image node_id 2 for calling a global function with example usage: test_bag_input_feature(bag_config, encoder) without return types