docstr: Make sure the use_cudnn and engine kwargs work as expected.
docstr_tok: ["Make","sure","the","use_cudnn","and","engine","kwargs","work","as","expected","."]
code: def test_use_cudnn_engine_interactions(self):
      """Make sure the use_cudnn and engine kwargs work as expected."""
      for model_default in [None, True, False]:
          arg_scope = {}
          if model_default is not None:
              arg_scope["use_cudnn"] = model_default
          else:
              model_default = True  # the default
  
          model = ModelHelper(arg_scope=arg_scope)
          self.assertEqual(model.arg_scope["use_cudnn"], model_default)
          f = functools.partial(
              brew.conv, model, "conv_in", "conv_out", 10, 10, 5
          )
  
          for op_cudnn in [None, True, False]:
              for op_engine in [None, "", "CUDNN"]:
                  kwargs = {}
                  if op_cudnn is not None:
                      kwargs["use_cudnn"] = op_cudnn
                  else:
                      op_cudnn = False  # the default
                  if op_engine is not None:
                      kwargs["engine"] = op_engine
  
                  calculated_cudnn = kwargs.get(
                      "use_cudnn", model_default
                  )
                  expected_engine = kwargs.get(
                      "engine", "CUDNN" if calculated_cudnn else ""
                  )
  
                  if (
                      calculated_cudnn is False and op_engine == "CUDNN"
                  ) or (calculated_cudnn is True and op_engine == ""):
                      with self.assertRaises(ValueError):
                          f(**kwargs)
                  else:
                      f(**kwargs)
                      self.assertEqual(
                          model.Proto().op[-1].engine, expected_engine
                      )
  
imports: import collections
  import functools
  import unittest
  import caffe2.python._import_c_extension
  import caffe2.python.hip_test_util
  import caffe2.python.hypothesis_test_util
  import caffe2.python.serialized_test.serialized_test_util
  import hypothesis.strategies
  import numpy
  from caffe2.proto import caffe2_pb2
  from caffe2.python import brew, core, utils, workspace
  from caffe2.python.model_helper import ModelHelper
  from hypothesis import assume, given, settings
label_desc: Use image node_id 10 for calling the TestConvolution obj's underlying member method code with example usage: obj.test_use_cudnn_engine_interactions() without return types