mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-27 03:11:28 +00:00
fix CalculateHash for Big Endian platforms. (#12752)
* fix CalculateHash for Big Endian platforms.
This commit is contained in:
parent
b83ea3c2ff
commit
4f244e48d5
1 changed files with 10 additions and 1 deletions
|
|
@ -45,7 +45,16 @@ void KernelDef::CalculateHash() {
|
|||
// kernel definition)
|
||||
|
||||
hash_str(op_name_);
|
||||
hash_int(op_since_version_start_);
|
||||
|
||||
if constexpr (onnxruntime::endian::native == onnxruntime::endian::little) {
|
||||
hash_int(op_since_version_start_);
|
||||
} else {
|
||||
const uint8_t* c = (const uint8_t*)&op_since_version_start_;
|
||||
hash_int((uint32_t)c[0] |
|
||||
(uint32_t)c[1] << 8 |
|
||||
(uint32_t)c[2] << 16 |
|
||||
(uint32_t)c[3] << 24);
|
||||
}
|
||||
|
||||
// If we include op_since_version_end_ the hash of an existing op changes when it's superseded.
|
||||
// e.g. Unsqueeze 11 had no end version until Unsqueeze 13, at which point the existing op is changed to have
|
||||
|
|
|
|||
Loading…
Reference in a new issue