code: def __init__(self, learning_rate=1e-4):
      with tf.Graph().as_default():
          # Create the model
          self.x = tf.placeholder(tf.float32, [None, 784])
  
          # Define loss and optimizer
          self.y_ = tf.placeholder(tf.float32, [None, 10])
  
          # Build the graph for the deep net
          self.y_conv, self.keep_prob = deepnn(self.x)
  
          with tf.name_scope("loss"):
              cross_entropy = tf.nn.softmax_cross_entropy_with_logits(
                  labels=self.y_, logits=self.y_conv
              )
          self.cross_entropy = tf.reduce_mean(cross_entropy)
  
          with tf.name_scope("adam_optimizer"):
              self.optimizer = tf.train.AdamOptimizer(learning_rate)
              self.train_step = self.optimizer.minimize(
                  self.cross_entropy
              )
  
          with tf.name_scope("accuracy"):
              correct_prediction = tf.equal(
                  tf.argmax(self.y_conv, 1), tf.argmax(self.y_, 1)
              )
              correct_prediction = tf.cast(
                  correct_prediction, tf.float32
              )
          self.accuracy = tf.reduce_mean(correct_prediction)
  
          self.sess = tf.Session(
              config=tf.ConfigProto(
                  intra_op_parallelism_threads=1,
                  inter_op_parallelism_threads=1,
              )
          )
          self.sess.run(tf.global_variables_initializer())
  
          # Helper values.
  
          self.variables = (
              ray.experimental.tf_utils.TensorFlowVariables(
                  self.cross_entropy, self.sess
              )
          )
  
          self.grads = self.optimizer.compute_gradients(
              self.cross_entropy
          )
          self.grads_placeholder = [
              (
                  tf.placeholder("float", shape=grad[1].get_shape()),
                  grad[1],
              )
              for grad in self.grads
          ]
          self.apply_grads_placeholder = self.optimizer.apply_gradients(
              self.grads_placeholder
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import time
  import tensorflow
  from tensorflow.examples.tutorials.mnist import input_data
  import ray
  import ray.experimental.tf_utils
  from bigdl.dllib.utils.log4Error import invalidInputError
label_desc: Use image node_id 1 to create a new SimpleCNN object from inherited base classes: object with example: obj = SimpleCNN(learning_rate)