def __setstate__(self, d):
        """
        Sets the object to have the state described by `d`.

        Parameters
        ----------
        d : dict
            A dictionary mapping string names of fields to values for
            these fields.
        """
        self.__dict__.update(d)
        if 'batch_record' not in d:
            self.batch_record = [None] * len(self.val_record)
        # Patch old pickle files that don't have the "epoch_record" field
        if 'epoch_record' not in d:
            # This is not necessarily correct but it is in the most common use
            # case where you don't add monitoring channels over time.
            self.epoch_record = range(len(self.val_record))
        if 'time_record' not in d:
            self.time_record = [None] * len(self.val_record)
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/monitor.py/MonitorChannel.__setstate__/original