code: def test_basic_nuclear(use_resource):
      # TODO:
      #       to address issue #36764
      for i, dtype in enumerate(
          _dtypes_with_checking_system(
              use_gpu=test_utils.is_gpu_available(),
              system=platform.system(),
          )
      ):
          if use_resource:
              var0 = tf.Variable(
                  [1.0, 2.0], dtype=dtype, name="var0_%d" % i
              )
              var1 = tf.Variable(
                  [3.0, 4.0], dtype=dtype, name="var1_%d" % i
              )
          else:
              var0 = tf.Variable([1.0, 2.0], dtype=dtype)
              var1 = tf.Variable([3.0, 4.0], dtype=dtype)
  
          grads0 = tf.constant([0.1, 0.1], dtype=dtype)
          grads1 = tf.constant([0.01, 0.01], dtype=dtype)
          top_singular_vector0 = (
              cg_lib.ConditionalGradient._top_singular_vector(grads0)
          )
          top_singular_vector1 = (
              cg_lib.ConditionalGradient._top_singular_vector(grads1)
          )
  
          def learning_rate():
              return 0.5
  
          def lambda_():
              return 0.01
  
          ord = "nuclear"
  
          cg_opt = cg_lib.ConditionalGradient(
              learning_rate=learning_rate, lambda_=lambda_, ord=ord
          )
          _ = cg_opt.apply_gradients(
              zip([grads0, grads1], [var0, var1])
          )
  
          # Check we have slots
          assert ["conditional_gradient"] == cg_opt.get_slot_names()
          slot0 = cg_opt.get_slot(var0, "conditional_gradient")
          assert slot0.get_shape() == var0.get_shape()
          slot1 = cg_opt.get_slot(var1, "conditional_gradient")
          assert slot1.get_shape() == var1.get_shape()
  
          test_utils.assert_allclose_according_to_type(
              np.array(
                  [
                      1.0 * 0.5
                      - (1 - 0.5) * 0.01 * top_singular_vector0[0],
                      2.0 * 0.5
                      - (1 - 0.5) * 0.01 * top_singular_vector0[1],
                  ]
              ),
              var0.numpy(),
          )
          test_utils.assert_allclose_according_to_type(
              np.array(
                  [
                      3.0 * 0.5
                      - (1 - 0.5) * 0.01 * top_singular_vector1[0],
                      4.0 * 0.5
                      - (1 - 0.5) * 0.01 * top_singular_vector1[1],
                  ]
              ),
              var1.numpy(),
          )
  
          # Step 2: the conditional_gradient contain the previous update.
          cg_opt.apply_gradients(zip([grads0, grads1], [var0, var1]))
          test_utils.assert_allclose_according_to_type(
              np.array(
                  [
                      (
                          1.0 * 0.5
                          - (1 - 0.5) * 0.01 * top_singular_vector0[0]
                      )
                      * 0.5
                      - (1 - 0.5) * 0.01 * top_singular_vector0[0],
                      (
                          2.0 * 0.5
                          - (1 - 0.5) * 0.01 * top_singular_vector0[1]
                      )
                      * 0.5
                      - (1 - 0.5) * 0.01 * top_singular_vector0[1],
                  ]
              ),
              var0.numpy(),
          )
          test_utils.assert_allclose_according_to_type(
              np.array(
                  [
                      (
                          3.0 * 0.5
                          - (1 - 0.5) * 0.01 * top_singular_vector1[0]
                      )
                      * 0.5
                      - (1 - 0.5) * 0.01 * top_singular_vector1[1],
                      (
                          4.0 * 0.5
                          - (1 - 0.5) * 0.01 * top_singular_vector1[0]
                      )
                      * 0.5
                      - (1 - 0.5) * 0.01 * top_singular_vector1[1],
                  ]
              ),
              var1.numpy(),
          )
  
imports: import numpy
  import pytest
  import platform
  import tensorflow
  from tensorflow_addons.utils import test_utils
  from tensorflow_addons.optimizers import conditional_gradient
label_desc: Use image node_id 6 for calling a global function with example usage: test_basic_nuclear(use_resource) and returns: int, int