scico icon indicating copy to clipboard operation
scico copied to clipboard

Document and test `input_dtype` and `output_dtype` policy

Open Michael-T-McCann opened this issue 2 years ago • 0 comments

We should decide what input_dtype and output_dtype mean, then document it.

Proposed input_dtype and output_dtype policy:

  • All instantiated Operators must have input_dtype and output_dtype properties
    • Possible data types are snp.float32, snp.float64, snp.complex64
  • at the level of Operator, we should call snp.dtype(input_dtype) to make sure it is a dtype and not a type
    • compare print(snp.float32) and print(snp.dtype(snp.float32)), second has nice repl
  • For an Operator H, H(x) should throw an error if x.dtype is not input_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
  • Operators should be written so that H(x).dtype is H.output_dtype; this will not be checked and runtime, but should be tested
  • Operators should attempt to automatically deduce input_dtype and output_dtype from other arguments and throw an error if the user requests an input_dtype or output_dtype that is not realizable

This policy should be described in the docs and implemented in the code.

Related: #165 #234

Michael-T-McCann avatar Oct 05 '22 15:10 Michael-T-McCann