从 halide::buffer 构造一个 halide::runtime:buffer

Construct a halide::runtime:buffer from halide::buffer

在halide::runtime::buffer的lesson_10:AOT compilation part 2, it said that "Halide::Runtime::Buffer also has constructors that wrap existing data instead of allocating new memory", but in the docs中,我找不到以Buffer为参数的构造函数,是否可以将halide::buffer转换为halide::runtime::buffer?

您可能正在寻找 Halide::Buffer<T>::get() 方法,即 returns 和 Halide::Runtime::Buffer<T>*。这是指向前端缓冲区 包装 的底层运行时缓冲区的指针。您应该注意以下几点:

A Halide::Buffer is a named shared reference to a Halide::Runtime::Buffer.

此外,Runtime::Buffer<T> 的大多数方法都可以通过 Buffer<T> 获得,只需使用 -> 运算符,它在内部调用 get() 并重载 here .