ML
ML copied to clipboard
No argument expansion for custom decorators with function parameters
Related to https://github.com/wala/ML/issues/91.
Consider the following code:
import tensorflow as tf
def mama(fun):
def wrapper_fun(*args, **kwargs):
assert isinstance(args[0], tf.Tensor)
fun(*args, **kwargs)
return wrapper_fun
@mama
def f(x):
assert isinstance(x, tf.Tensor)
f(tf.constant(1))
Currently, Ariadne doesn't expand *args and **kwargs, so we miss the tensor parameter x of `().
There's another case as well. The one in the description describes a scenario where the function has parameters. But, the decorator also could have parameters, and there's a different problem there.