tvm_tirx.tirx.analysis.detect_linear_equation

tvm_tirx.tirx.analysis.detect_linear_equation#

tvm_tirx.tirx.analysis.detect_linear_equation(expr, var_list)#

Match expr = sum_{i=0}^{n-1} var[i] * coeff[i] + coeff[n]

Where coeff[i] and base are invariant of var[j] for all i and j.

Parameters:
  • expr (Expr) – The expression to be matched.

  • var_list (List[tvm_tirx.ir.Var]) – A list of variables.

Returns:

coeff (List[Expr]) – A list of co-efficients if the match is successful. An empty list if the match failed.