/usr/local/lib64/python3.6/site-packages/torch/include/ATen/core/dispatch
Edit: /usr/local/lib64/python3.6/site-packages/torch/include/ATen/core/dispatch/RegistrationHandleRAII.h (858B)
#pragma once
#include
namespace c10 {
class RegistrationHandleRAII final {
public:
explicit RegistrationHandleRAII(std::function onDestruction)
: onDestruction_(std::move(onDestruction)) {}
~RegistrationHandleRAII() {
if (onDestruction_) {
onDestruction_();
}
}
RegistrationHandleRAII(const RegistrationHandleRAII&) = delete;
RegistrationHandleRAII& operator=(const RegistrationHandleRAII&) = delete;
RegistrationHandleRAII(RegistrationHandleRAII&& rhs) noexcept
: onDestruction_(std::move(rhs.onDestruction_)) {
rhs.onDestruction_ = nullptr;
}
RegistrationHandleRAII& operator=(RegistrationHandleRAII&& rhs) noexcept {
onDestruction_ = std::move(rhs.onDestruction_);
rhs.onDestruction_ = nullptr;
return *this;
}
private:
std::function onDestruction_;
};
}