报一个小bug,用num_fakes做切片时没有取整。
Created by: 131250208
报错信息:
TypeError Traceback (most recent call last)
<ipython-input-7-039e026fb8a7> in <module>
30 # step 8: predict
31 print('predicting..')
---> 32 results = trainer.predict(print_steps=print_steps)
~/anaconda3/envs/paddle/lib/python3.6/site-packages/paddlepalm/trainer.py in predict(self, output_dir, print_steps)
645 cur_predict_step = 0
646 for feed in iterator:
--> 647 rt_outputs = self.predict_one_batch(feed)
648 # rt_outputs = {k[len(self.name+'.'):]: v for k,v in rt_outputs.items() if k.startswith(self.name+'.')}
649 self._pred_head.batch_postprocess(rt_outputs)
~/anaconda3/envs/paddle/lib/python3.6/site-packages/paddlepalm/trainer.py in predict_one_batch(self, batch)
752 num_fakes = decode_fake(len(rt_outputs[0]), mask, self._predict_batch_size)
753 if num_fakes:
--> 754 rt_outputs = [i[:-num_fakes] for i in rt_outputs]
755 else:
756 feed = self._pred_feed_batch_process_fn(batch)
~/anaconda3/envs/paddle/lib/python3.6/site-packages/paddlepalm/trainer.py in <listcomp>(.0)
752 num_fakes = decode_fake(len(rt_outputs[0]), mask, self._predict_batch_size)
753 if num_fakes:
--> 754 rt_outputs = [i[:-num_fakes] for i in rt_outputs]
755 else:
756 feed = self._pred_feed_batch_process_fn(batch)
TypeError: slice indices must be integers or None or have an __index__ method
Debug:
ipdb> num_fakes
6.0