def METHOD_NAME(self, n, nesterov, gc, dc):
    assume(core.IsGPUDeviceType(gc.device_type))
    gpuvers = workspace.GetDeviceProperties(0)["major"]
    if gc.device_type == caffe2_pb2.CUDA and gpuvers < 6:
        print("No FP16 support because major version {} < 6".format(gpuvers))
        return
    param = np.random.rand(n).astype(np.float16)
    grad = np.random.rand(n).astype(np.float16)
    lr = np.random.rand(1).astype(np.float32)
    param_momentum = np.random.rand(n).astype(np.float16)
    momentum = 0.9
    def momentum_sgd(grad, param_momentum, lr, param=None):
        if not nesterov:
            adjusted_gradient = lr * grad + momentum * param_momentum
            paramup = param - adjusted_gradient
            return [adjusted_gradient, adjusted_gradient, paramup]
        else:
            m_new = momentum * param_momentum + lr * grad
            grad_new = (1 + momentum) * m_new - momentum * param_momentum
            paramup = param - grad_new
            return [grad_new, m_new, paramup]
    op = core.CreateOperator(
        "FP16MomentumSGDUpdate",
        ["grad", "param_momentum", "lr", "param"],
        ["grad", "param_momentum", "param"],
        momentum=momentum,
        nesterov=int(nesterov),
        weight_decay=0.0,
    )
    threshold = 1e-3 if (gc.device_type == caffe2_pb2.HIP) else 1e-4
    self.assertReferenceChecks(
        device_option=gc,
        op=op,
        inputs=[grad, param_momentum, lr, param],
        reference=momentum_sgd,
        threshold=threshold
    )