def METHOD_NAME(self, shape: Expr, dtype_str: str) -> int:
    if not isinstance(shape, ShapeExpr):
        raise TypeError(
            "The shape of relax.builtin.alloc_tensor and "
            "relax.memory.alloc_tensor is expected to be ShapeExpr"
        )
    size: int = 1
    for dim_len in shape.values:
        if not isinstance(dim_len, tvm.tir.IntImm):
            self.total_dyn_size_tensor_num += 1
            return -1
        size *= dim_len.value
    dtype = tvm.DataType(dtype_str)
    return size * ((dtype.bits + 7) // 8) * dtype.lanes