Add convenience function to `Operator` to apply it to random samples
When developing generative models, one often needs to pass random samples through operator chains to evaluate their output.
To eliminate the need to type op(ift.from_random(op.domain))
all the time, this MR adds the method get_random_sample()
to ift.operators.operator.Operator
. It implements the above given code without introducing import loops and passes keyword arguments through to the from_random
call to make it as general as the reference code.
@parras @mtr What do you think about it? Do you have objections, also to the naming of the function? Is this functionality already present somehow?
Cheers!