def update()

in torchnet/utils/resultswriter.py [0:0]


    def update(self, task_name, result):
        ''' Update the results file with new information.

        Args:
            task_name (str): Name of the currently running task. A previously unseen
                ``task_name`` will create a new entry in both :attr:`tasks`
                and :attr:`results`.
            result: This will be appended to the list in :attr:`results` which
                corresponds to the ``task_name`` in ``task_name``:attr:`tasks`.

        '''
        with open(self.filepath, 'rb') as f:
            existing_results = pickle.load(f)
        if task_name not in self.tasks:
            self._add_task(task_name)
            existing_results['tasks'].append(task_name)
            existing_results['results'].append([])
        task_name_idx = existing_results['tasks'].index(task_name)
        results = existing_results['results'][task_name_idx]
        results.append(result)
        with open(self.filepath, 'wb') as f:
            pickle.dump(existing_results, f)