本文整理汇总了C++中Func::infer_arguments方法的典型用法代码示例。如果您正苦于以下问题:C++ Func::infer_arguments方法的具体用法?C++ Func::infer_arguments怎么用?C++ Func::infer_arguments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Func
的用法示例。
在下文中一共展示了Func::infer_arguments方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check
void check(const std::string &inner_loop_level,
const std::string &outer_loop_level) {
Buffer<float> result = outer.realize(1, 1, 1);
Module m = outer.compile_to_module({outer.infer_arguments()});
CheckLoopLevels c(inner_loop_level, outer_loop_level);
m.functions().front().body.accept(&c);
}
示例2: rdom_wrapper_test
int rdom_wrapper_test() {
Func source("source"), g("g"), result("result");
Var x("x"), y("y");
source(x, y) = x + y;
ImageParam img(Int(32), 2, "img");
Buffer<int> buf = source.realize(200, 200);
img.set(buf);
g(x, y) = 10;
g(x, y) += 2 * img(x, x);
RDom r(0, 200, 0, 200);
g(r.x, r.y) += 3 * img(r.y, r.y);
// Make a global wrapper on 'g', so that we can schedule initialization
// and the update on the same compute level at the global wrapper
Func wrapper = g.in().compute_root();
g.compute_at(wrapper, x);
Func img_f = img;
img_f.compute_root();
// Check the call graphs.
// Expect 'wrapper' to call 'g', initialization of 'g' to call nothing
// and its update to call 'img_f' and 'g', 'img_f' to call 'img'
Module m = wrapper.compile_to_module({wrapper.infer_arguments()});
CheckCalls c;
m.functions().front().body.accept(&c);
CallGraphs expected = {
{g.name(), {img_f.name(), g.name()}},
{wrapper.name(), {g.name()}},
{img_f.name(), {img.name()}},
};
if (check_call_graphs(c.calls, expected) != 0) {
return -1;
}
Buffer<int> im = wrapper.realize(200, 200);
auto func = [](int x, int y) { return 4*x + 6* y + 10; };
if (check_image(im, func)) {
return -1;
}
return 0;
}
示例3: main
int main(int argc, char **argv) {
Param<float> reservoirConcentration;
Param<float> stepTime;
Param<float> layerMixConst;
Param<float> layerTimeDivisor;
Func sumDx;
Func layerMixed;
Func initialDeveloperMirrored;
ImageParam devConc(type_of<float>(),2);
Func dDevelConc;
Func developerConcentration = lambda(x,y,devConc(x,y));
dDevelConc = calcLayerMix(developerConcentration, layerMixConst, stepTime,
layerTimeDivisor, reservoirConcentration);
std::vector<Argument> ddcArgs = dDevelConc.infer_arguments();
dDevelConc.compile_to_file("calcLayerMix",ddcArgs);
return 0;
}