With DJL, I want to write a ‘LambdaBlock’ that takes an
NDList as input and returns a same-shaped
NDList setting all inputs to 1 (assuming the NDList has only one entry).
The best I came up with is:
new LambdaBlock(x-> new NDList(x.singletonOrThrow().sub(x.singletonOrThrow()).add(1f)))
Is there a way to achieve the same without using subtraction operation (so it would be executed faster)?