@richard i have tried you solution but it did not work for me and i got an error like
assert (input >= 0. & input <= 1.).all()
TypeError: unsupported operand type(s) for &: ‘float’ and ‘builtin_function_or_method’