models/dense_net.py
def test(self, data, batch_size):
        """
        Tests the model using the proper testing set.

        Args:
            data: testing data yielded by the dataset's data provider;
            batch_size: `int`, number of examples in a testing batch.
        """
        num_examples = data.num_examples
        total_loss = []
        for l in range(len(self.cross_entropy)):
            total_loss.append([])
        total_accuracy = []

        # save each testing batch's loss and accuracy
        for i in range(num_examples // batch_size):
            batch = data.next_batch(batch_size)
            feed_dict = {
                self.images: batch[0],
                self.labels: batch[1],
                self.is_training: False,
            }
            loss = self.sess.run(self.cross_entropy, feed_dict=feed_dict)
            accuracy = self.sess.run(self.accuracy, feed_dict=feed_dict)
            for j in range(len(loss)):
                total_loss[j].append(loss[j])
            total_accuracy.append(accuracy)

        # use the saved data to calculate the mean loss and accuracy
        mean_loss = []
        for loss_list in total_loss:
            mean_loss.append(np.mean(loss_list))
        mean_accuracy = np.mean(total_accuracy)
        return mean_loss, mean_accuracy

        Tests the model using the proper testing set.

        Args:
            data: testing data yielded by the dataset's data provider;
            batch_size: `int`, number of examples in a testing batch.
        
Tests the model using the proper testing set.
Tests the model using the proper testing set .
def test(self, data, batch_size):
        num_examples = data.num_examples
        total_loss = []
        for l in range(len(self.cross_entropy)):
            total_loss.append([])
        total_accuracy = []
        for i in range(num_examples // batch_size):
            batch = data.next_batch(batch_size)
            feed_dict = {
                self.images: batch[0],
                self.labels: batch[1],
                self.is_training: False,
            }
            loss = self.sess.run(self.cross_entropy, feed_dict=feed_dict)
            accuracy = self.sess.run(self.accuracy, feed_dict=feed_dict)
            for j in range(len(loss)):
                total_loss[j].append(loss[j])
            total_accuracy.append(accuracy)
        mean_loss = []
        for loss_list in total_loss:
            mean_loss.append(np.mean(loss_list))
        mean_accuracy = np.mean(total_accuracy)
        return mean_loss, mean_accuracy
def test ( self , data , batch_size ) : num_examples = data . num_examples total_loss = [ ] for l in range ( len ( self . cross_entropy ) ) : total_loss . append ( [ ] ) total_accuracy = [ ] for i in range ( num_examples // batch_size ) : batch = data . next_batch ( batch_size ) feed_dict = { self . images : batch [ 0 ] , self . labels : batch [ 1 ] , self . is_training : False , } loss = self . sess . run ( self . cross_entropy , feed_dict = feed_dict ) accuracy = self . sess . run ( self . accuracy , feed_dict = feed_dict ) for j in range ( len ( loss ) ) : total_loss [ j ] . append ( loss [ j ] ) total_accuracy . append ( accuracy ) mean_loss = [ ] for loss_list in total_loss : mean_loss . append ( np . mean ( loss_list ) ) mean_accuracy = np . mean ( total_accuracy ) return mean_loss , mean_accuracy
Tests the model using the proper testing set.
Tests the model using the proper testing set .
"""
        Tests the model using the proper testing set.

        Args:
            data: testing data yielded by the dataset's data provider;
            batch_size: `int`, number of examples in a testing batch.
        """ # save each testing batch's loss and accuracy # use the saved data to calculate the mean loss and accuracy
self
data
testing data yielded by the dataset's data provider.
testing data yielded by the dataset ' s data provider .
batch_size
`int`, number of examples in a testing batch.
` int ` number of examples in a testing batch .