def log2(x): """Take logarithm to the base 2 of input x. Parameters ---------- x : tvm.te.Tensor Input argument. Returns ------- y : tvm.te.Tensor The result. """ return te.compute(x.shape, lambda *i: te.log2(x(*i)))
def clz_imp(inp): # Assuming that it's a 32 bit int return 32 - te.log2(inp)