Unverified Commit 11aa0c14 authored by PanZezhong1725's avatar PanZezhong1725 Committed by GitHub
Browse files

issue/719 add more logs

parent 0f5e66ce
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <type_traits> #include <type_traits>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <spdlog/spdlog.h>
namespace infinicore::nn { namespace infinicore::nn {
class Module { class Module {
......
...@@ -33,14 +33,17 @@ inline struct SpdlogInitializer { ...@@ -33,14 +33,17 @@ inline struct SpdlogInitializer {
} \ } \
} while (false) } while (false)
#define INFINICORE_ASSERT_TENSORS_SAME_DEVICE(FIRST___, ...) \ #define INFINICORE_ASSERT_TENSORS_SAME_DEVICE(FIRST___, ...) \
do { \ do { \
const auto &first_device___ = (FIRST___)->device(); \ const auto &first_device___ = (FIRST___)->device(); \
for (const auto &tensor___ : {__VA_ARGS__}) { \ for (const auto &tensor___ : {__VA_ARGS__}) { \
if (first_device___ != (tensor___)->device()) { \ if (first_device___ != (tensor___)->device()) { \
throw std::runtime_error("Tensor devices mismatch " \ throw std::runtime_error("Tensor devices mismatch " \
+ first_device___.toString() + " vs " \ + first_device___.toString() + " vs " \
+ (tensor___)->device().toString() + "."); \ + (tensor___)->device().toString() \
} \ + " from " + std::string(__func__) \
} \ + " at " + std::string(__FILE__) \
+ ":" + std::to_string(__LINE__) + "."); \
} \
} \
} while (0) } while (0)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment