code: def test_check_spec():
      with pytest.raises(ValueError, match="should be an akro.Box"):
          # Input space is not Box or Image
          _check_spec(InOutSpec(akro.Dict(), None), "NCHW")
      with pytest.raises(
          ValueError, match="should have three dimensions"
      ):
          # Too many input dimensions
          _check_spec(
              InOutSpec(
                  akro.Box(
                      shape=[1, 1, 1, 1], low=-np.inf, high=np.inf
                  ),
                  None,
              ),
              "NCHW",
          )
      with pytest.raises(
          ValueError, match="akro.Box with a single dimension"
      ):
          # Output is not one-dimensional
          _check_spec(
              InOutSpec(
                  akro.Box(shape=[1, 1, 1], low=-np.inf, high=np.inf),
                  akro.Box(
                      shape=[1, 1],
                      low=-np.inf,
                      high=np.inf,
                  ),
              ),
              "NCHW",
          )
      with pytest.warns(UserWarning):
          # 4 color channels should warn
          _check_spec(
              InOutSpec(
                  akro.Box(shape=[4, 1, 1], low=-np.inf, high=np.inf),
                  None,
              ),
              "NCHW",
          )
  
file_path: garage/tests/garage/torch/modules/test_cnn_module.py
imports: import pickle
  import akro
  import numpy
  import pytest
  import torch
  import torch.nn
  from garage import InOutSpec
  from garage.torch.modules import CNNModule
  from garage.torch.modules.cnn_module import _check_spec
label_desc: Use image node_id 2 for calling a global function with example usage: test_check_spec() without return types