I'm new to Halide so also kinda didn't know how to ask the question. Let me explain. Let's assume I have a simple code for Halide's generator like this:
class Blur : public Generator<Blur>{
public:
Input<Buffer<float>> in_func{"in_func", 2};
Output<Buffer<float>> forward{"forward", 2};
Var x, y, n;
void generate(){
Expr m1 = in_func(x+1, y+2)+in_func(x+2, y+1);
Expr m2 = in_func(x+1, y+2)-in_func(x+2, y+1);
Expr m3 = in_func(x+2, y+1)+in_func(x+1, y+1);
Expr m4 = in_func(x+2, y+1)-in_func(x+1, y+1);
Expr w0010_2 = -in_func(x+2, y+2)+in_func(x, y+2);
Expr w0111_2 = -in_func(x+3, y+2)+in_func(x+1, y+2);
forward(0,0) = w0010_2+m4+m3+m2+m1;
forward(1,0) = -w0111_2+m4+m3-m2-m1;
forward(0,1) = w0010_2-m4+m3-m2+m1;
forward(1,1) = w0111_2-m4+m3+m2-m1;
}
};
What I want to achieve is to define that output at index (0,0) should be the result of m1 + m2 but output at index (1,0) should be the result of different expression, for example, m1 - m2. I would be really grateful for help.