code: def test_control_inputs(self):
      features = np.random.randn(20, 10)
      labels = np.random.randint(0, 10, size=[20])
      with tf.Graph().as_default():
          dataset = TFDataset.from_ndarrays(
              (features, labels),
              batch_size=4,
              val_tensors=(features, labels),
          )
          is_training = tf.placeholder(dtype=tf.bool, shape=())
          feature_tensor, label_tensor = dataset.tensors
          features = tf.layers.dense(feature_tensor, 8)
          features = tf.layers.dropout(features, training=is_training)
          output = tf.layers.dense(features, 10)
          loss = tf.reduce_mean(
              tf.losses.sparse_softmax_cross_entropy(
                  logits=output, labels=label_tensor
              )
          )
          optimizer = TFOptimizer.from_loss(
              loss,
              Adam(),
              val_outputs=[output],
              val_labels=[label_tensor],
              val_method=Accuracy(),
              tensor_with_value={is_training: (True, False)},
              metrics={"loss": loss},
          )
          optimizer.optimize(end_trigger=MaxEpoch(1))
          optimizer.sess.close()
  
file_path: analytics-zoo/pyzoo/test/zoo/tfpark/test_tfpark_tfoptimizer.py
imports: import pytest
  from bigdl.optim.optimizer import Adam, SGD, MaxEpoch
  from zoo.pipeline.api.keras.metrics import Accuracy
  from test.zoo.pipeline.utils.test_utils import ZooTestCase
  import tensorflow
  import numpy
  import tempfile
  import os
  from zoo.tfpark import TFDataset, TFOptimizer
label_desc: Use image node_id 4 for calling the TestTFParkTFOptimizer obj's underlying member method code with example usage: obj.test_control_inputs() without return types