TomographicImaging / CIL

A versatile python framework for tomographic imaging
https://tomographicimaging.github.io/CIL/
Apache License 2.0
95 stars 41 forks source link

AXPBY will not work with BlockDataContainer #1078

Closed epapoutsellis closed 2 years ago

epapoutsellis commented 2 years ago

Currently axpby cannot be used when a and b are BlockDataContainer

/opt/anaconda3/envs/cil_devel_epaps/lib/python3.7/site-packages/cil/framework/framework.py:2421: RuntimeWarning: invalid value encountered in true_divide
  pwop(self.as_array(), x2.as_array(), *args, **kwargs )
Source path:... /opt/anaconda3/envs/cil_devel_epaps/lib/python3.7/site-packages/cil/framework/BlockDataContainer.py
Starting var:.. self = <cil.framework.BlockDataContainer.BlockDataContainer object at 0x7f7b848c6410>
Starting var:.. a = <cil.framework.BlockDataContainer.BlockDataContainer object at 0x7f7b848c6b10>
Starting var:.. b = 1.0
Starting var:.. y = <cil.framework.BlockDataContainer.BlockDataContainer object at 0x7f7b848c6450>
Starting var:.. out = <cil.framework.BlockDataContainer.BlockDataContainer object at 0x7f7b848c6410>
Starting var:.. dtype = <class 'numpy.float32'>
Starting var:.. num_threads = 20
10:16:43.911994 call       219     def axpby(self, a, b, y, out, dtype=numpy.float32, num_threads = NUM_THREADS):
10:16:43.912278 line       230         if out is None:
10:16:43.912327 line       232         kwargs = {'a':a, 'b':b, 'out':out, 'dtype': dtype, 'num_threads': NUM_THREADS}
New var:....... kwargs = {'a': <cil.framework.BlockDataContainer.BlockDat...ype': <class 'numpy.float32'>, 'num_threads': 20}
10:16:43.912384 line       233         self.binary_operations(BlockDataContainer.AXPBY, y, **kwargs)
10:16:43.912680 exception  233         self.binary_operations(BlockDataContainer.AXPBY, y, **kwargs)
Exception:..... ValueError: cannot copy sequence with size 2 to array axis with dimension 0
paskino commented 2 years ago

The consequence of this is that we cannot do diagonal preconditioning with PDHG.