dace
dace copied to clipboard
String literal evaluated as variable in callback parameters
When passing a string literal in a callback argument which value is the exact name of another variable, it gets swapped with the variable __repr__ instead of being treated as a string literal.
Code:
import dace
import numpy as np
def force_callback(fn):
return fn
@force_callback
def a_callback(an_arr: np.ndarray, a_name: str):
print(
a_name
) # < This should print "an_arr" but will print the __repr__ of an_arr instead
@dace.program
def the_program(an_arr):
an_arr[:] = 4
a_callback(an_arr, "an_arr") # < any other string literal works fine
an_arr = np.ones((10))
the_program(an_arr)
Expecting: an_arr to be printed, but getting [4. 4. 4. 4. 4. 4. 4. 4. 4. 4.]