Param#
-
template<typename T = void>
class Param# A scalar parameter to a halide pipeline.
If you’re jitting, this should be bound to an actual value of type T using the set method before you realize the function uses this. If you’re statically compiling, this param should appear in the argument list.
Public Functions
-
inline Param()#
Construct a scalar parameter of type T with a unique auto-generated name.
-
inline explicit Param(const std::string &n)#
Construct a scalar parameter of type T with the given name.
-
template<typename T2 = T, std::enable_if_t<!std::is_pointer_v<T2>>* = nullptr>
inline explicit Param(not_void_T val)# Construct a scalar parameter of type T an initial value of ‘val’.
Only triggers for non-pointer types.
-
inline Param(const std::string &n, not_void_T val)#
Construct a scalar parameter of type T with the given name and an initial value of ‘val’.
-
inline Param(not_void_T val, const Expr &min, const Expr &max)#
Construct a scalar parameter of type T with an initial value of ‘val’ and a given min and max.
-
inline Param(const std::string &n, not_void_T val, const Expr &min, const Expr &max)#
Construct a scalar parameter of type T with the given name and an initial value of ‘val’ and a given min and max.
-
template<typename OTHER_TYPE>
inline Param(const Param<OTHER_TYPE> &other)# Construct a Param<T> from a Param with matching type (or from any Param, if T is void).
The check is done at runtime so that we can construct from Param<void> if the types are compatible.
-
template<typename OTHER_TYPE>
inline Param<T> &operator=(const Param<OTHER_TYPE> &other)# Copy a Param<T> from a Param with matching type (or from any Param, if T is void).
The check is done at runtime so that we can assign from Param<void> if the types are compatible.
-
inline const std::string &name() const#
Get the name of this parameter.
-
template<typename T2 = not_void_T>
inline T2 get() const# Get the current value of this parameter.
Only meaningful when jitting. Asserts if type does not exactly match the Parameter’s type.
-
template<typename SOME_TYPE>
inline void set(const SOME_TYPE &val)# Set the current value of this parameter.
Only meaningful when jitting. Asserts if type is not losslessly-convertible to Parameter’s type.
-
inline void set_range(const Expr &min, const Expr &max)#
Get or set the possible range of this parameter.
Use undefined Exprs to mean unbounded.
-
inline operator Expr() const#
You can use this parameter as an expression in a halide function definition.
-
inline operator ExternFuncArgument() const#
Using a param as the argument to an external stage treats it as an Expr.
Public Static Functions
-
inline Param()#