class_docstr: This is an abstract base class.
  Don't inherit from unittest.TestCase, and don't name it 'Test*'.
  Do, however, do these things in classes which inherit from this.
code: def testGPUDense(self, dtype=core.DataType.FLOAT):
      device_opt = core.DeviceOption(workspace.GpuDeviceType, 0)
      with core.DeviceScope(device_opt):
          model, _perfect_model, data, label = self._createDense(dtype)
          if dtype == core.DataType.FLOAT16:
              fc_fp32_for_host = model.HalfToFloat(
                  "fc", "fc_fp32_for_host"
              )
              model.CopyGPUToCPU(fc_fp32_for_host, "fc_cpu")
          else:
              model.CopyGPUToCPU("fc", "fc_cpu")
          workspace.FeedBlob("data", data[0])
          workspace.FeedBlob("label", label[0])
  
      # Add some CPU ops
      brew.fc(model, "fc_cpu", "fc2", dim_in=1, dim_out=10, axis=0)
  
      # Create optimizer in default device scope
      self.build_optimizer(model)
  
      if self._skip_gpu:
          return
  
      # Run net to see it does not crash
      workspace.RunNetOnce(model.param_init_net)
      workspace.CreateNet(model.net, True)
      workspace.RunNet(model.net.Proto().name)
  
file_path: pytorch/caffe2/python/optimizer_test_util.py
imports: import unittest
  import numpy
  from caffe2.python import brew, core, workspace, cnn, optimizer
  from caffe2.python.modeling.initializers import Initializer, PseudoFP16Initializer
  from caffe2.python.model_helper import ModelHelper
label_desc: Use image node_id 3 for calling the OptimizerTestBase obj's underlying member method code with example usage: obj.testGPUDense(dtype) without return types