code: def test_get_rnn_init_state_uses_hidden(num_layers):
      batch_size = 16
      sequence_length = 32
      state_size = 64
      combiner_outputs = {}
      combiner_outputs[HIDDEN] = torch.rand(
          [batch_size, sequence_length, state_size]
      )
  
      # With sequence reduction.
      result = sequence_decoder_utils.get_rnn_init_state(
          combiner_outputs,
          SequenceReducer(reduce_mode="sum"),
          num_layers,
      )
      assert list(result.size()) == [num_layers, batch_size, state_size]
  
      # Without sequence reduction.
      with pytest.raises(ValueError):
          sequence_decoder_utils.get_rnn_init_state(
              combiner_outputs,
              SequenceReducer(reduce_mode="none"),
              num_layers,
          )
  
file_path: ludwig/tests/ludwig/decoders/test_sequence_decoder_utils.py
imports: import pytest
  import torch
  from ludwig.constants import ENCODER_OUTPUT_STATE, HIDDEN
  from ludwig.decoders import sequence_decoder_utils
  from ludwig.modules.reduction_modules import SequenceReducer
label_desc: Use image node_id 1 for calling a global function with example usage: test_get_rnn_init_state_uses_hidden(num_layers) without return types