code: def test_nnabla_models_semantic_segmentation(
      model_class,
      up_to_list,
      image_size_factor,
      batch_size,
      training,
      _dataset_name,
      seed,
  ):
      nn.clear_parameters()
      rng = np.random.RandomState(seed)
  
      # Load model
      from nnabla.models.semantic_segmentation import DeepLabV3plus
  
      nn.clear_parameters()
      rng = np.random.RandomState(seed)
      model = DeepLabV3plus(_dataset_name)
  
      # Determine input shape and create input variable
      input_shape = list(model.input_shape)
      input_shape[1] *= image_size_factor
      input_shape[2] *= image_size_factor
      input_shape = tuple(input_shape)
      x = nn.Variable.from_numpy_array(
          rng.randint(0, 256, size=(batch_size,) + input_shape)
      )
  
      # Test cases for all intermediate outputs
      for use_up_to in up_to_list:
          returns_net = False
  
          def _execute():
              y = model(x, training=training, use_up_to=use_up_to)
              y.forward()
  
          _execute()
          net = model(
              x,
              training=training,
              use_up_to=use_up_to,
              returns_net=True,
          )
          assert isinstance(net, NnpNetwork)
          assert len(net.inputs.values()) == 1
          assert len(net.outputs.values()) == 1
          y = list(net.outputs.values())[0]
          if training:
              assert _check_trainable_parameters(y)
          else:
              assert not _check_trainable_parameters(y)
  
file_path: nnabla/python/test/models/test_deeplabv3plus.py
imports: from __future__ import absolute_import
  import pytest
  from nnabla.utils.nnp_graph import NnpNetwork
  import nnabla
  import numpy
  from nnabla.models.utils import get_model_url_base_from_env
label_desc: Use image node_id 2 for calling a global function with example usage: test_nnabla_models_semantic_segmentation(model_class, up_to_list, image_size_factor, batch_size, training, _dataset_name, seed) without return types