tensorflow_tutorials/deep_mnist/deep_mnist.py
def train(self, train_data, test_data=None, session=None):
        """
        Train the model with the data and return the session.
        Will create a new session if not given.

        If `test_data` is given, will print out training accuracy
        every 100 training steps.
        """
        if session is None:
            session = self.new_session()

        for i in range(self._config['training']):
            if i % 100 == 0 and test_data:
                accuracy = session.run(self.accuracy, feed_dict={
                    self.inputs: test_data.images,
                    self.distribution: test_data.labels,
                    self.keep_prob: 1.0
                })
                print("step %d, training accuracy %g" % (i, accuracy))

            batch_xs, batch_ys = train_data.next_batch(self._config['batches'])

            session.run(self.train_step, feed_dict={
                self.inputs: batch_xs,
                self.distribution: batch_ys,
                self.keep_prob: self.KEEP_PROB
            })

        return session

        Train the model with the data and return the session.
        Will create a new session if not given.

        If `test_data` is given, will print out training accuracy
        every 100 training steps.
        
Train the model with the data and return the session.
Will create a new session if not given.

If `test_data` is given, will print out training accuracy
every 100 training steps.
Train the model with the data and return the session . Will create a new session if not given . If ` test_data ` is given will print out training accuracy every 100 training steps .
def train(self, train_data, test_data=None, session=None):
        if session is None:
            session = self.new_session()
        for i in range(self._config['training']):
            if i % 100 == 0 and test_data:
                accuracy = session.run(self.accuracy, feed_dict={
                    self.inputs: test_data.images,
                    self.distribution: test_data.labels,
                    self.keep_prob: 1.0
                })
                print("step %d, training accuracy %g" % (i, accuracy))
            batch_xs, batch_ys = train_data.next_batch(self._config['batches'])
            session.run(self.train_step, feed_dict={
                self.inputs: batch_xs,
                self.distribution: batch_ys,
                self.keep_prob: self.KEEP_PROB
            })
        return session
def train ( self , train_data , test_data = None , session = None ) : if session is None : session = self . new_session ( ) for i in range ( self . _config [ 'training' ] ) : if i % 100 == 0 and test_data : accuracy = session . run ( self . accuracy , feed_dict = { self . inputs : test_data . images , self . distribution : test_data . labels , self . keep_prob : 1.0 } ) print ( "step %d, training accuracy %g" % ( i , accuracy ) ) batch_xs , batch_ys = train_data . next_batch ( self . _config [ 'batches' ] ) session . run ( self . train_step , feed_dict = { self . inputs : batch_xs , self . distribution : batch_ys , self . keep_prob : self . KEEP_PROB } ) return session
Train the model with the data and return the session.
Train the model with the data and return the session .
"""
        Train the model with the data and return the session.
        Will create a new session if not given.

        If `test_data` is given, will print out training accuracy
        every 100 training steps.
        """
self
train_data
test_data
session