My file is compiled ahead of time. I calculate small Regions out of an Image. Over these i'd like to normalize with overlap. Therefore i a Func thats calculating the factor with Reduction Domains. Afterwards i try to calculate normalized Regions that are overlapping. The result therefore has a bigger size. As long as the Func i realize is the small Regions its working, when i try compile to b its not working anymore as the result has to have another dimension as the one needed for c. Is there any way to set dimensions for a Func depending on in- or output buffer dimension? Or do you know any other workarounds?
Func cells("cells");
c(g_x,g_y,g_i) = 0.0f;
// this is working
c(g_x, g_y, g_i) = ...
Var c_x("c_x"), c_y("c_y");
// calculate normalization factor
Func norm_factor("norm_factor");
// cpb means cells per block
RDom cbd (0,cpb,0,cpb,0, nBins);
Expr lx = c_x + cbd.x;
Expr ly = c_y + cbd.y;
Expr lz = cbd.z;
norm_factor(c_x, c_y) = 1 / sqrt(Halide::sum(c(lx, ly, lz) * c(lx, ly, lz)) + eta*eta );
// Caculate the normalized Blocks
Func b("blocks");
b(c_x,c_y,g_i) = 0.f;
b(c_x, c_y, g_i) = norm_factor(g_x, g_y) * c(g_x,g_y,g_i);
b.compile_to_file("halide",args);