def do_write_features(self):
		if not os.path.exists(self.feature_path):
			os.makedirs(self.feature_path)
		next_data = self.get_next_batch(train=False)
		b1 = next_data[1]
		num_ftrs = self.layers[self.ftr_layer_idx]['outputs']
		while True:
			batch = next_data[1]
			data = next_data[2]
			ftrs = n.zeros((data[0].shape[1], num_ftrs), dtype=n.single)
			self.libmodel.startFeatureWriter(data + [ftrs], self.ftr_layer_idx)
			
			# load the next batch while the current one is computing
			next_data = self.get_next_batch(train=False)
			self.finish_batch()
			path_out = os.path.join(self.feature_path, 'data_batch_%d' % batch)
			pickle(path_out, {'data': ftrs, 'labels': data[1]})
			print path_out % "Wrote feature file %s"
			if next_data[1] == b1:
				break
		pickle(os.path.join(self.feature_path, 'batches.meta'), {'source_model':self.load_file,
																 'num_vis':num_ftrs})
dataset/ETHPy150Open zygmuntz/kaggle-cifar/shownet.py/ShowConvNet.do_write_features/swapped operands of `%`