MNN/source/backend/cpu/CPUResizeCache.hpp

28 lines
647 B
C++
Raw Normal View History

#ifndef CPURESIZECACHE_HPP
#define CPURESIZECACHE_HPP
#include <map>
#include <MNN/Tensor.hpp>
#include "MNN_generated.h"
namespace MNN {
2022-02-18 11:30:27 +08:00
// FIXME: Move outside
class MNN_PUBLIC CPUResizeCache {
public:
2022-02-18 11:30:27 +08:00
CPUResizeCache() {
// Do nothing
}
~ CPUResizeCache() {
// Do nothing
}
Tensor* findCacheTensor(const Tensor* src, MNN_DATA_FORMAT format) const;
// Return cache tensor
void pushCacheTensor(std::shared_ptr<Tensor> dst, const Tensor* src, MNN_DATA_FORMAT format);
void reset();
private:
std::map<std::pair<const Tensor*, MNN_DATA_FORMAT>, std::shared_ptr<Tensor>> mFormatCache;
};
}
#endif