24.02.1
|
Go to the documentation of this file.
24 #ifndef ACL_SRC_DYNAMIC_FUSION_SKETCH_ARGUMENTPACK_H
25 #define ACL_SRC_DYNAMIC_FUSION_SKETCH_ARGUMENTPACK_H
29 #include <unordered_map>
34 namespace experimental
36 namespace dynamic_fusion
87 ArgumentPack(
const std::initializer_list<PackElement> &l) : _pack{}
89 for (
const auto &e : l)
101 _pack[id] = PackElement(
id,
tensor);
110 _pack[id] = PackElement(
id,
tensor);
120 auto it = _pack.find(
id);
121 return it != _pack.end() ? it->second.tensor :
nullptr;
131 auto it = _pack.find(
id);
132 if (it != _pack.end())
134 return it->second.ctensor !=
nullptr ? it->second.ctensor : it->second.tensor;
160 return _pack.empty();
168 std::vector<T *> src_tensors{};
174 src_tensors.push_back(
tensor);
185 std::vector<const T *> src_tensors{};
191 src_tensors.push_back(
tensor);
202 std::vector<T *> dst_tensors{};
208 dst_tensors.push_back(
tensor);
219 std::vector<const T *> dst_tensors{};
225 dst_tensors.push_back(
tensor);
232 std::unordered_map<int, PackElement> _pack{};
237 #endif // ACL_SRC_DYNAMIC_FUSION_SKETCH_ARGUMENTPACK_H
const T * get_const_tensor(Id id) const
Get constant tensor of a given id.
bool empty() const
Checks if pack is empty.
PackElement(Id id, const T *ctensor)
std::vector< T * > get_src_tensors()
Get the ACL_SRC_* tensors.
std::vector< T * > get_dst_tensors()
Get the ACL_DST_* tensors.
This is a generic class that packs the arguments of an operator.
A single argument element within the pack It contains either a const pointer or a non-const pointer t...
void add_const_tensor(Id id, const T *tensor)
Add const tensor to the pack.
ArgumentPack()=default
Default constructor.
T * get_tensor(Id id)
Get tensor of a given id from the pack.
size_t size() const
Pack size accessor.
T * tensor
Non-const pointer to tensor-related object.
void add_tensor(Id id, T *tensor)
Add tensor to the pack.
ArgumentPack< T > & operator=(const ArgumentPack< T > &other)=default
Allow instances of this class to be copied.
PackElement(Id id, T *tensor)
PackElement & operator=(const PackElement &elem)=default
~ArgumentPack()=default
Destructor.
CLTensor * tensor
Pointer to the auxiliary tensor.
std::vector< const T * > get_const_dst_tensors() const
Get the const ACL_DST_* tensors.
const T * ctensor
Const pointer to tensor-related object.
Id id
Argument id within the pack.
void remove_tensor(Id id)
Remove the tensor stored with the given id.
Copyright (c) 2017-2024 Arm Limited.
std::vector< const T * > get_const_src_tensors() const
Get the const ACL_SRC_* tensors.
ArgumentPack(const std::initializer_list< PackElement > &l)
Initializer list Constructor.