Variable used only in type annotations are not captured to the transformed functions
roastduck opened this issue · comments
Example:
def main():
import freetensor as ft
# ERROR: `ft` not found
@ft.transform(verbose=2)
def test(x: ft.Var[(4,), "float32"]):
y = x + 1
return y
# OK
#@ft.transform(verbose=2)
#def test(x: ft.Var[(4,), "float32"]):
# y = ft.zeros((4,), "float32")
# y[...] = x + 1
# return y
main()
ft
is captured if it is used in ft.zeros
, but it is not captured if only used in ft.Var
.