Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions cmake/patches/onnx/onnx.patch
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,29 @@ index 0c271d5..6d64da7 100644
fail_shape_inference(
"Unexpected axis value (",
axis,
diff --git a/onnx/common/tensor.h b/onnx/common/tensor.h
--- a/onnx/common/tensor.h
+++ b/onnx/common/tensor.h
@@ -51,14 +51,20 @@
/// if tensor is a scalar, the sizes is empty, but the element number is actually 1.
/// size_from_dim() cannot handle this case, while elem_num() handles it correctly
int64_t elem_num() const {
- return safe_dim_product(sizes_, [](const char* msg) { throw tensor_error(msg); });
+ return safe_dim_product(sizes_, [](const char* msg) {
+ std::string error_msg(msg);
+ throw_tensor_error(error_msg);
+ });
Comment thread
rvandermeulen marked this conversation as resolved.
}
int64_t size_from_dim(int dim) const {
if (dim < 0) {
dim += static_cast<int>(sizes_.size());
}
ONNX_ASSERT(dim >= 0 && (size_t)dim < sizes_.size())
- return safe_dim_product(sizes_.begin() + dim, sizes_.end(), [](const char* msg) { throw tensor_error(msg); });
+ return safe_dim_product(sizes_.begin() + dim, sizes_.end(), [](const char* msg) {
+ std::string error_msg(msg);
+ throw_tensor_error(error_msg);
+ });
}

int32_t elem_type() const {
26 changes: 26 additions & 0 deletions cmake/vcpkg-ports/onnx/binskim.patch
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,29 @@ index 0c271d5..6d64da7 100644
fail_shape_inference(
"Unexpected axis value (",
axis,
diff --git a/onnx/common/tensor.h b/onnx/common/tensor.h
--- a/onnx/common/tensor.h
+++ b/onnx/common/tensor.h
@@ -51,14 +51,20 @@
/// if tensor is a scalar, the sizes is empty, but the element number is actually 1.
/// size_from_dim() cannot handle this case, while elem_num() handles it correctly
int64_t elem_num() const {
- return safe_dim_product(sizes_, [](const char* msg) { throw tensor_error(msg); });
+ return safe_dim_product(sizes_, [](const char* msg) {
+ std::string error_msg(msg);
+ throw_tensor_error(error_msg);
+ });
}
int64_t size_from_dim(int dim) const {
if (dim < 0) {
dim += static_cast<int>(sizes_.size());
}
ONNX_ASSERT(dim >= 0 && (size_t)dim < sizes_.size())
- return safe_dim_product(sizes_.begin() + dim, sizes_.end(), [](const char* msg) { throw tensor_error(msg); });
+ return safe_dim_product(sizes_.begin() + dim, sizes_.end(), [](const char* msg) {
+ std::string error_msg(msg);
+ throw_tensor_error(error_msg);
+ });
}

int32_t elem_type() const {