I have a function that returns a Func
and I'd like to set the input buffers that are defined as ImageParam
s. I can't seem to find a tutorial/test from the github repo that uses this sort of feature. I could use generators to compile in AOT and then link another program to it, but I'm sure there's a faster way to do that in the same instance without recompiling... I just can't seem to find the right way!
Here's the piece of code I use:
//header
Func create_func();
//usage
Func f = create_func();
Buffer<uint8_t> input; //initialized somewhere
Buffer<uint8_t> output0; //initialized somewhere
Buffer<uint8_t> output1; //initialized somewhere
f.in(0).set(input); // I need to set the buffer here right?
f.realize({output0, output1});
Edit: I found a "workaround" that implies I pass the reference to the ImageParam
as an out parameter like so:
ImageParam p;
create_func(&p);
p.set(input);
But this seems like cheating doesn't it? I'd really like to pull the input parameters from the Func
itself if possible...