Skip to content

Commit

Permalink
remove checks again
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-at-pieces committed Feb 14, 2024
1 parent b86cc54 commit 8b63a09
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions onnx/checker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,6 @@ void check_tensor(const TensorProto& tensor, const CheckerContext& ctx) {
entry.value(),
"' points outside the directory");
}
std::wstring data_path = path_join(utf8str_to_wstring(ctx.get_model_dir()), relative_path);
struct _stat64 buff;
if (_wstat64(data_path.c_str(), &buff) != 0) {
fail_check(
"Data of TensorProto ( tensor name: ",
tensor.name(),
") should be stored in ",
entry.value(),
", but it doesn't exist or is not accessible.");
}
#else // POSIX
if (entry.value().empty()) {
fail_check("Location of external TensorProto ( tensor name: ", tensor.name(), ") should not be empty.");
Expand All @@ -188,31 +178,6 @@ void check_tensor(const TensorProto& tensor, const CheckerContext& ctx) {
entry.value(),
"' points outside the directory");
}
std::string data_path = path_join(ctx.get_model_dir(), relative_path);
// use stat64 to check whether the file exists
#if defined(__APPLE__) || defined(__wasm__) || !defined(__GLIBC__)
struct stat buffer; // APPLE, wasm and non-glic stdlibs do not have stat64
if (stat((data_path).c_str(), &buffer) != 0) {
#else
struct stat64 buffer; // All POSIX under glibc except APPLE and wasm have stat64
if (stat64((data_path).c_str(), &buffer) != 0) {
#endif
fail_check(
"Data of TensorProto ( tensor name: ",
tensor.name(),
") should be stored in ",
data_path,
", but it doesn't exist or is not accessible.");
}
// Do not allow symlinks or directories.
if (!S_ISREG(buffer.st_mode)) {
fail_check(
"Data of TensorProto ( tensor name: ",
tensor.name(),
") should be stored in ",
data_path,
", but it is not regular file.");
}
#endif
}
}
Expand Down

0 comments on commit 8b63a09

Please sign in to comment.