问题遇到的现象和发生背景
python报错:ValueError: reached x=0
after 0 iterations
问题相关代码,请勿粘贴截图
复现代码https://github.com/haimiaozh/MetaInv-Net
operator的定义:
operator = odl.tomo.RayTransform(space, geometry,impl='astra_cuda'
报错语句:
x_norm = x.norm()
if x_norm == 0:
raise ValueError('reached ``x=0`` after {} iterations'.format(i))
运行结果及报错内容
报错内容:
Traceback (most recent call last):
File "/root/autodl-tmp/MetaInv-Net-main/main.py", line 17, in <module>
train = Trainer(args, model, tr_dset=tr_dataset)
File "/root/autodl-tmp/MetaInv-Net-main/trainer/train.py", line 18, in __init__
self.proj, self.back_proj, _, self.op_norm = self.tr_dset.radon_op()
File "/root/autodl-tmp/MetaInv-Net-main/data_loader/dataset.py", line 38, in radon_op
op_norm=odl.operator.power_method_opnorm(operator)
File "/root/miniconda3/envs/my-env/lib/python3.6/site-packages/odl/operator/oputils.py", line 246, in power_method_opnorm
raise ValueError('reached ``x=0`` after {} iterations'.format(i))
ValueError: reached ``x=0`` after 0 iterations
我的解答思路和尝试过的方法
尝试输出operator的值,它的值为RayTransform