scico
scico copied to clipboard
Document and test `input_dtype` and `output_dtype` policy
We should decide what input_dtype
and output_dtype
mean, then document it.
Proposed input_dtype
and output_dtype
policy:
- All instantiated
Operator
s must haveinput_dtype
andoutput_dtype
properties- Possible data types are
snp.float32
,snp.float64
,snp.complex64
- Possible data types are
- at the level of
Operator
, we should callsnp.dtype(input_dtype)
to make sure it is a dtype and not a type- compare
print(snp.float32)
andprint(snp.dtype(snp.float32))
, second has nice repl
- compare
- For an
Operator
H
,H(x)
should throw an error ifx.dtype
is notinput_dtype
- Instead: how about input_dtype is the "largest" dtype allowed, passing a "smaller" one is allowed
- Would this still work on the adjoint? NO, so largest dtype does not work
- Instead: how about input_dtype is the "largest" dtype allowed, passing a "smaller" one is allowed
-
Operator
s should be written so thatH(x).dtype
isH.output_dtype
; this will not be checked and runtime, but should be tested -
Operator
s should attempt to automatically deduceinput_dtype
andoutput_dtype
from other arguments and throw an error if the user requests aninput_dtype
oroutput_dtype
that is not realizable
This policy should be described in the docs and implemented in the code.
Related: #165 #234