mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-12-23 14:54:28 +00:00
Migrate concat layer
This commit is contained in:
@@ -21,6 +21,30 @@ class InvalidShapeException : public std::runtime_error {
|
||||
actual
|
||||
)
|
||||
) {}
|
||||
|
||||
InvalidShapeException(
|
||||
const std::string& message,
|
||||
const Shape& shape_a,
|
||||
const Shape& shape_b
|
||||
)
|
||||
: std::runtime_error(
|
||||
std::format(
|
||||
"{}. Shape A: [{}], Shape B: [{}]",
|
||||
message,
|
||||
format_shape(shape_a),
|
||||
format_shape(shape_b)
|
||||
)
|
||||
) {}
|
||||
|
||||
private:
|
||||
static std::string format_shape(const Shape& shape) {
|
||||
std::string result;
|
||||
for (size_t i = 0; i < shape.size(); ++i) {
|
||||
if (i > 0) result += ", ";
|
||||
result += std::to_string(shape[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace CUDANet
|
||||
|
||||
Reference in New Issue
Block a user