Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yangbofun committed Aug 22, 2024
1 parent 08dd817 commit b0d8771
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions impl/ascend/aclnn/adaptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,15 @@ decltype(auto) convertType(T&& param) {
}
}

// For the case that the input is not a class or a pointer, do nothing.
template <class T, class U = std::remove_reference_t<T>, std::enable_if_t<!std::is_class_v<U> && !std::is_pointer_v<U>, int> = 0>
void releaseConverted(T&& param [[maybe_unused]]) {} // no conversion, do nothing
template<class T>
struct NeedReleaseType : std::disjunction<std::is_same<std::remove_cv_t<T>, aclTensor*>, std::is_same<std::remove_cv_t<T>, aclTensorList*>,
std::is_same<std::remove_cv_t<T>, aclScalar*>, std::is_same<std::remove_cv_t<T>, aclScalarList*>,
std::is_same<std::remove_cv_t<T>, aclIntArray*>, std::is_same<std::remove_cv_t<T>, aclBoolArray*>,
std::is_same<std::remove_cv_t<T>, aclFloatArray*>> {};

// Overload for const char* const&
inline void releaseConverted(const char* const& param [[maybe_unused]]) {}
// For the case that the input is not a class or a pointer, do nothing.
template <class T, std::enable_if_t<!NeedReleaseType<T>::value, int> = 0>
void releaseConverted(T param) {} // no conversion, do nothing

#define IMPL_ASCEND_ACLNN_REGISTER_DESTRUCTOR(Type) \
inline void releaseConverted(const acl##Type* param) { \
Expand Down

0 comments on commit b0d8771

Please sign in to comment.