/usr/local/lib64/python3.6/site-packages/torch/include/torch/csrc/utils
Edit: /usr/local/lib64/python3.6/site-packages/torch/include/torch/csrc/utils/memory.h (1173B)
#pragma once
#include
namespace torch {
// Reference:
// https://github.com/llvm-mirror/libcxx/blob/master/include/memory#L3091
template
struct unique_type_for {
using value = std::unique_ptr;
};
template
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
struct unique_type_for {
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
using unbounded_array = std::unique_ptr;
};
template
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
struct unique_type_for {
using bounded_array = void;
};
template
typename unique_type_for::value make_unique(Args&&... args) {
return std::unique_ptr(new T(std::forward(args)...));
}
template
typename unique_type_for::unbounded_array make_unique(size_t size) {
using U = typename std::remove_extent::type;
return std::unique_ptr(new U[size]());
}
template
typename unique_type_for::bounded_array make_unique(Args&&...) = delete;
} // namespace torch