class_docstr: Simple class for a one layer neural network.
  
  Note that this code does not initialize the network weights. Instead
  weights are set via self.variables.set_weights.
  
  Example:
      net = LinearModel([10, 10])
      weights = [np.random.normal(size=[10, 10]),
                 np.random.normal(size=[10])]
      variable_names = [v.name for v in net.variables]
      net.variables.set_weights(dict(zip(variable_names, weights)))
  
  Attributes:
      x (tf.placeholder): Input vector.
      w (tf.Variable): Weight matrix.
      b (tf.Variable): Bias vector.
      y_ (tf.placeholder): Input result vector.
      cross_entropy (tf.Operation): Final layer of network.
      cross_entropy_grads (tf.Operation): Gradient computation.
      sess (tf.Session): Session used for training.
      variables: Extracted variables and methods to
          manipulate them.
class_docstr_tok: ["Simple","class","for","a","one","layer","neural","network",".","Note","that","this","code","does","not","initialize","the","network","weights",".","Instead","weights","are","set","via","self.variables.set_weights",".","Example",":","net","=","LinearModel","(","[","10",",","10","]",")","weights","=","[","np.random.normal","(","size=","[","10",",","10","]",")",",","np.random.normal","(","size=","[","10","]",")","]","variable_names","=","[","v.name","for","v","in","net.variables","]","net.variables.set_weights","(","dict","(","zip","(","variable_names",",","weights",")",")",")","Attributes",":","x","(","tf.placeholder",")",":","Input","vector",".","w","(","tf.Variable",")",":","Weight","matrix",".","b","(","tf.Variable",")",":","Bias","vector",".","y_","(","tf.placeholder",")",":","Input","result","vector",".","cross_entropy","(","tf.Operation",")",":","Final","layer","of","network",".","cross_entropy_grads","(","tf.Operation",")",":","Gradient","computation",".","sess","(","tf.Session",")",":","Session","used","for","training",".","variables",":","Extracted","variables","and","methods","to","manipulate","them","."]
docstr: Creates a LinearModel object.
docstr_tok: ["Creates","a","LinearModel","object","."]
code: def __init__(self, shape):
      """Creates a LinearModel object."""
      x = tf.placeholder(tf.float32, [None, shape[0]])
      w = tf.Variable(tf.zeros(shape))
      b = tf.Variable(tf.zeros(shape[1]))
      self.x = x
      self.w = w
      self.b = b
      y = tf.nn.softmax(tf.matmul(x, w) + b)
      y_ = tf.placeholder(tf.float32, [None, shape[1]])
      self.y_ = y_
      cross_entropy = tf.reduce_mean(
          -tf.reduce_sum(y_ * tf.log(y), reduction_indices=[1])
      )
      self.cross_entropy = cross_entropy
      self.cross_entropy_grads = tf.gradients(cross_entropy, [w, b])
      self.sess = tf.Session()
      # In order to get and set the weights, we pass in the loss function to
      # Ray's TensorFlowVariables to automatically create methods to modify
      # the weights.
      self.variables = ray.experimental.tf_utils.TensorFlowVariables(
          cross_entropy, self.sess
      )
  
file_path: ray/doc/source/ray-core/examples/lbfgs/driver.py
imports: import os
  import numpy
  import scipy.optimize
  import tensorflow
  from tensorflow.examples.tutorials.mnist import input_data
  import ray
  import ray.experimental.tf_utils
label_desc: Use image node_id 1 to create a new LinearModel object from inherited base classes: object with example: obj = LinearModel(shape)