MCPcopy Create free account
hub / github.com/RenderKit/oidn / getHash

Method getHash

core/tensor.cpp:48–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46
47#if 0
48 uint32_t Tensor::getHash() const
49 {
50 std::vector<uint8_t> hostBytes;
51 const uint8_t* bytes;
52
53 if (buffer && buffer->getStorage() == Storage::Device)
54 {
55 // Copy the tensor to the host
56 hostBytes.resize(getByteSize());
57 getBuffer()->getEngine()->usmCopy(hostBytes.data(), getPtr(), getByteSize());
58 bytes = hostBytes.data();
59 }
60 else
61 {
62 bytes = static_cast<const uint8_t*>(getPtr());
63 }
64
65 const size_t numBytes = getByteSize();
66 uint32_t hash = 0x811c9dc5;
67 for (size_t i = 0; i < numBytes; ++i)
68 {
69 hash ^= bytes[i];
70 hash *= 0x1000193;
71 }
72 return hash;
73 }
74
75 void Tensor::dump(const std::string& filenamePrefix)
76 {

Callers 1

submitMethod · 0.80

Calls 6

getPtrFunction · 0.85
dataMethod · 0.80
getByteSizeFunction · 0.70
getStorageMethod · 0.45
usmCopyMethod · 0.45
getEngineMethod · 0.45

Tested by

no test coverage detected