trainers/trainer.py
def train_step(self):
        """
       implement the logic of the train step
       - run the tensorflow session
       - :return any accuracy and loss on current batch
       """
#         print(f'device memory cached : {torch.cuda.memory_cached(0)}')
#         print(f'device memory allocated : {torch.cuda.memory_allocated(0)}')
        graphs, labels = self.data_loader.next_batch()
        graphs = torch.from_numpy(graphs)
        labels = torch.from_numpy(labels)
        if self.config.cuda:
            graphs = graphs.cuda()
            labels = labels.cuda()
#         print(f'graphs device : {graphs.device}')
        output = self.model(graphs)
#         output = output.cpu().data
        loss = self.model.loss(output, labels)
        correct = self.model.correct_predictions(output, labels)
#         _, loss, correct = self.sess.run([self.model.train_op, self.model.loss, self.model.correct_predictions],
#                                      feed_dict={self.model.graphs: graphs, self.model.labels: labels,
#                                                 self.model.is_training: True})
        return loss, correct

       implement the logic of the train step
       - run the tensorflow session
       - :return any accuracy and loss on current batch
       
implement the logic of the train step
run the tensorflow session
:return any accuracy and loss on current batch
implement the logic of the train step run the tensorflow session : return any accuracy and loss on current batch
def train_step(self):
        graphs, labels = self.data_loader.next_batch()
        graphs = torch.from_numpy(graphs)
        labels = torch.from_numpy(labels)
        if self.config.cuda:
            graphs = graphs.cuda()
            labels = labels.cuda()
        output = self.model(graphs)
        loss = self.model.loss(output, labels)
        correct = self.model.correct_predictions(output, labels)
        return loss, correct
def train_step ( self ) : graphs , labels = self . data_loader . next_batch ( ) graphs = torch . from_numpy ( graphs ) labels = torch . from_numpy ( labels ) if self . config . cuda : graphs = graphs . cuda ( ) labels = labels . cuda ( ) output = self . model ( graphs ) loss = self . model . loss ( output , labels ) correct = self . model . correct_predictions ( output , labels ) return loss , correct
implement the logic of the train step
 run the tensorflow session
 :return any accuracy and loss on current batch
implement the logic of the train step run the tensorflow session : return any accuracy and loss on current batch
"""
       implement the logic of the train step
       - run the tensorflow session
       - :return any accuracy and loss on current batch
       """ #         print(f'device memory cached : {torch.cuda.memory_cached(0)}') #         print(f'device memory allocated : {torch.cuda.memory_allocated(0)}') #         print(f'graphs device : {graphs.device}') #         output = output.cpu().data #         _, loss, correct = self.sess.run([self.model.train_op, self.model.loss, self.model.correct_predictions], #                                      feed_dict={self.model.graphs: graphs, self.model.labels: labels, #                                                 self.model.is_training: True})
self