Search code examples
halide

No member named dim in Halide::GeneratorInput<Halide::Func>


I'm trying to translate the resize app from the halide repository from the inline declarations to a generator. Everything seems to work fine, except for this:

Func clamped = BoundaryConditions::repeat_edge(input);`

In the original code, input is declared like so ImageParam input(Float(32), 3). In my generator, I've translated this to: Input<Func> input { "input", Float(32), 3 }. I'm then declaring the clamped in the exact same way as the original code. When compiling, I'm getting this error:

Halide.h:15202:50: error: no member named 'dim' in 'Halide::GeneratorInput<Halide::Func>'
    object_bounds.push_back({ Expr(func_like.dim(i).min()), Expr(func_like.dim(i).extent()) });
                                   ~~~~~~~~~ ^

Is there a way to create a BoundaryConditions::repeat_edge on an Input<Func>?


Solution

  • There is, associate a Buffer<> with it. (Maybe a Buffer in your case, try it out).

     struct MyGen : Generator<MyGen> {
         Input<Buffer<>> dim_only_input_buffer{ "dim_only_input_buffer", 3 }; 
         ... 
      };
    

    I ran into something similar, you can see more about this in this github issue