While working on a pull request for Ivy machine learning framework I got this issue:
E AssertionError: Frontend function returned non-frontend arrays: ivy.array(1.)
E Falsifying example: test_torch_kron(
E frontend='torch',
E backend_fw='numpy',
E on_device='cpu',
E dtype_and_x=(['float16', 'float16'],
E [array(-1., dtype=float16), array(-1., dtype=float16)]),
E fn_tree='ivy.functional.frontends.torch.kron',
E test_flags=FrontendFunctionTestFlags(
E num_positional_args=0,
E with_out=False,
E inplace=False,
E as_variable=[False],
E native_arrays=[False],
E generate_frontend_arrays=False,
E ),
E )
E
E You can reproduce this example by temporarily adding @reproduce_failure('6.82.4', b'AXicY2AAAkYGCGBEYzMwAAAAXwAF') as a decorator on your test case
How could I resolve it?
To understand the issue, I looked for other questions in stackoverflow, google and the documentation of the framework
Frontend functions/methods are supposed to always return a frontend array which is why we use @to_ivy_arrays_and_back. So you are supposed to get this error if you forget the decorator.
This has been explained here: https://unify.ai/docs/ivy/overview/deep_dive/ivy_frontends.html#writing-frontend-functions