24.04
|
Go to the documentation of this file.
38 namespace experimental
40 namespace dynamic_fusion
44 void calculate_and_init_dst_if_empty(ITensorInfo *
dst,
const ITensorInfo *
src,
const ResizeAttributes &attributes)
46 if (
dst->total_size() == 0U)
48 TensorShape out_shape =
src->tensor_shape();
50 out_shape.set(1, attributes.output_width());
51 out_shape.set(2, attributes.output_height());
57 Status is_supported_op_helper(
const GpuWorkloadContext &
context,
58 const ITensorInfo *
src,
59 const ITensorInfo *
dst,
60 const ResizeAttributes &attributes)
63 TensorInfo dst_info_to_validate;
64 const ITensorInfo *dst_info_to_validate_ptr = &dst_info_to_validate;
68 dst_info_to_validate_ptr =
dst;
71 calculate_and_init_dst_if_empty(&dst_info_to_validate,
src, attributes);
81 "Interpolation policy must be NEAREST_NEIGHBOR or BILINEAR");
86 const auto cl_compile_ctx =
context.cl_compile_context();
91 const KernelProperties properties =
94 ArgumentPack<ITensorInfo> arguments;
96 arguments.add_const_tensor(
ACL_DST_0, dst_info_to_validate_ptr);
114 return is_supported_op_helper(
context,
src,
nullptr, attributes);
127 calculate_and_init_dst_if_empty(&dst_info_to_validate,
src, attributes);
137 "Operator fusion test failed. This operator cannot be fused into the workload");
153 calculate_and_init_dst_if_empty(
dst,
src, attributes);
165 const auto properties =
Operator new_operator(const GpuOperatorType &operator_type, const ArgumentPack< ITensorInfo > &tensors) const
Create a new operator.
SimpleTensor< float > src
@ Run
Run every time after the first time.
@ NHWC
Num samples, height, width, channels.
ITensorInfo * create_virtual_tensor()
Create a virtual (see MemoryType) tensor info and save it.
const GpuOperatorGroup & operator_group() const
Get operator group.
bool try_add_operator(const Operator &op, bool is_output=false) const
Try adding (without actually adding) an operator to the group.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
A multi-input (tensors), multi-output (tensors) acyclic directed graph of gpu kernel components Its m...
static Status is_supported_op(const GpuWorkloadContext &context, const ITensorInfo *src, const Attributes &attributes)
Check if the operator configuration is supported, irrespective of fusion.
This is a generic class that packs the arguments of an operator.
const GpuWorkloadContext * gpu_context() const
Get the gpu workload context of this sketch.
static ITensorInfo * create_op(GpuWorkloadSketch &sketch, ITensorInfo *src, const Attributes &attributes)
Create an operator and fuse it into the workload sketch.
Implementation & implementation()
Get the implementation.
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
Attributes are backend-agnostic parameters (in addition to the input/output tensors) of an operator.
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
@ Complex
Complex operators are operators that are not simple but are still fusable with simple ones.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
const GpuKernelComponentGraph & component_graph() const
Get component graph.
static Status validate(const Properties &properties, const ArgumentPack< ITensorInfo > &tensors, const Attributes &attributes)
Validate the component.
A descriptor of a workload of operators.
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
bool auto_init_if_empty(ITensorInfo &info, const TensorShape &shape, int num_channels, DataType data_type, QuantizationInfo quantization_info=QuantizationInfo())
Auto initialize the tensor info (shape, number of channels and data type) if the current assignment i...
Provide context necessary for the creation and configuration of a workload e.g.
void add_const_tensor(Id id, const T *tensor)
Add const tensor to the pack.
const Context * context() const
Get workload context.
KernelProperties & stage(const UnitWorkloadStage &stage)
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_LAYOUT_NOT_IN(t,...)
@ BILINEAR
Output values are defined by bilinear interpolation between the pixels.
Describes when a unit workload is run.
static Status validate_op(const GpuWorkloadSketch &sketch, const ITensorInfo *src, const Attributes &attributes)
Validate the operator and check if the its configuration is supported and if it can be fused into the...
GpuOperatorType
Contain properties common to all operator types.
Store the tensor's metadata.
void add_new_component(Args &&...args)
Create a new component and add it to the component graph Component id is automatically allocated.
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
An operator for the sole purpose of validating fusion.
Copyright (c) 2017-2024 Arm Limited.
@ F16
16-bit floating-point number
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
@ NEAREST_NEIGHBOR
Output values are defined to match the source pixel whose center is nearest to the sample position.
KernelProperties Properties
Store the tensor's metadata.
#define ARM_COMPUTE_RETURN_ERROR_MSG(...)
An error is returned with the given description.
@ F32
32-bit floating-point number
void add_operator(const Operator &op, bool is_output=false)
Add an operator to the group.
#define ARM_COMPUTE_LOG_PARAMS(...)