code: def _check_outputs_and_grad_outputs(outputs, grad_outputs):
      if len(outputs) != len(grad_outputs):
          raise ValueError(
              "Output gradients must contain equally as many elements as "
              "the number of output elements.\n"
              "{}".format(
                  _make_outputs_props_in_error_message(
                      outputs, grad_outputs
                  )
              )
          )
  
      shapes_match = True
      dtypes_match = True
      for y, gy in zip(outputs, grad_outputs):
          if gy is None:
              continue
          if y is None and (gy == 0).all():
              continue
          if y.shape != gy.shape:
              shapes_match = False
          if y.dtype != gy.dtype:
              dtypes_match = False
  
      if not (shapes_match and dtypes_match):
          raise ValueError(
              "Shapes and/or dtypes of outputs and output gradients do not "
              "match.\n"
              "{}".format(
                  _make_outputs_props_in_error_message(
                      outputs, grad_outputs
                  )
              )
          )
  
imports: from __future__ import absolute_import
  import warnings
  import numpy
  import six
  import chainer
  from chainer import backend
  from chainer.backends import _cpu
  from chainer.backends import cuda
  from chainer import configuration
  from chainer import testing
  from chainer import utils
  from chainer import variable
  import chainerx
label_desc: Use image node_id 4 for calling a global function with example usage: _check_outputs_and_grad_outputs(outputs, grad_outputs) without return types