def __init__(self, graph_input, val, name, data_specs, dataset,
                 prereqs=None, old_channel=None):
        self.name = name
        self.prereqs = prereqs
        self.graph_input = graph_input
        self.data_specs = data_specs
        if isinstance(val, float):
            val = T.constant(np.cast[config.floatX](val))
        self.val = val
        self.val_shared = sharedX(0.0, name + "_tracker")
        assert self.val_shared.dtype == config.floatX, \
            "expected %s, got %s" % (config.floatX, self.val_shared.dtype)
        if not hasattr(val, 'dtype'):
            raise TypeError('Monitor channel ' + name + ' has value of type ' +
                            str(type(val)))
        if val.dtype != self.val_shared.dtype:
            raise ValueError('monitor channels are expected to have dtype ' +
                             str(self.val_shared.dtype) + ' but "' + name +
                             '" has dtype ' + str(val.dtype))
        if val.ndim != 0:
            raise ValueError('monitor channels are supposed to have zero ' +
                             'dimensions but "' + name + '" has ' +
                             str(val.ndim))
        # Dataset monitored by this channel
        self.dataset = dataset
        if old_channel is not None:
            # Value of the desired quantity at measurement time.
            self.val_record = old_channel.val_record[:-1]
            # Number of batches seen at measurement time.
            self.batch_record = old_channel.batch_record[:-1]
            # Number of examples seen at measurement time (batch sizes may
            # fluctuate).
            self.example_record = old_channel.example_record[:-1]
            self.epoch_record = old_channel.epoch_record[:-1]
            self.time_record = old_channel.time_record[:-1]
        else:
            # Value of the desired quantity at measurement time.
            self.val_record = []
            # Number of batches seen at measurement time.
            self.batch_record = []
            # Number of examples seen at measurement time (batch sizes may
            # fluctuate).
            self.example_record = []
            self.epoch_record = []
            self.time_record = []
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/monitor.py/MonitorChannel.__init__/original