code: def test_flow_to_docker_compose_gpus(tmpdir, count):
      flow = Flow().add(name="encoder", gpus=count)
      dump_path = os.path.join(
          str(tmpdir), "test_flow_docker_compose_gpus.yml"
      )
  
      flow.to_docker_compose_yaml(
          output_path=dump_path,
      )
  
      configuration = None
      with open(dump_path, encoding="utf-8") as f:
          configuration = yaml.safe_load(f)
  
      services = configuration["services"]
      encoder_service = services["encoder"]
      assert encoder_service["deploy"] == {
          "resources": {
              "reservations": {
                  "devices": [
                      {
                          "driver": "nvidia",
                          "count": count,
                          "capabilities": ["gpu"],
                      }
                  ]
              }
          }
      }
  
file_path: jina/tests/unit/orchestrate/flow/flow-construct/test_flow_to_docker_compose_yaml.py
imports: import json
  import os
  from pathlib import Path
  from unittest import mock
  import pytest
  import yaml
  from jina import Flow
  from jina.constants import __cache_path__
label_desc: Use image node_id 5 for calling a global function with example usage: test_flow_to_docker_compose_gpus(tmpdir, count) without return types