Implement InvalidShapeException

This commit is contained in:
2025-11-21 18:54:45 +01:00
parent 6685aa6629
commit c83e1f0c45
6 changed files with 77 additions and 91 deletions

View File

@@ -6,4 +6,21 @@ namespace CUDANet {
typedef std::vector<size_t> Shape;
} // namespace CUDANet
class InvalidShapeException : public std::runtime_error {
public:
InvalidShapeException(
const std::string& param_name,
size_t expected,
size_t actual
)
: std::runtime_error(
std::format(
"Invalid {} shape. Expected {}, actual {}",
param_name,
expected,
actual
)
) {}
};
} // namespace CUDANet