From 7907f45ca8755536891398e99c1470322b59ab7f Mon Sep 17 00:00:00 2001 From: Tristan Konolige Date: Tue, 14 Sep 2021 20:37:40 -0700 Subject: [PATCH] [TIR] Add conversion from FloatImm to float in Python (#9009) This method matches the IntImm method for converting from IntImm to int. --- python/tvm/tir/expr.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/tvm/tir/expr.py b/python/tvm/tir/expr.py index 4ba8c5471b5d..2bfa0aacb184 100644 --- a/python/tvm/tir/expr.py +++ b/python/tvm/tir/expr.py @@ -523,6 +523,9 @@ def __init__(self, dtype, value, span=None): tvm.ir._ffi_api.FloatImm, dtype, value, span # type: ignore ) + def __float__(self): + return self.value + @tvm._ffi.register_object class IntImm(ConstExpr):