MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / SingleCommit

Function SingleCommit

tensorflow/core/kernels/embedding_variable_ops_test.cc:1161–1178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1159}
1160
1161void SingleCommit(KVInterface<int64, float>* hashmap,
1162 std::vector<int64> keys, int bias) {
1163 std::vector<void*> value_ptrs;
1164 for (int64 i = 0; i < keys.size(); ++i) {
1165 void* tmp = cpu_allocator()->AllocateRaw(0, 124 * sizeof(float) + 16);
1166 for (int j = 0; j < 124; j++) {
1167 ((float*)tmp)[j] = keys[i] + bias;
1168 }
1169 value_ptrs.push_back(tmp);
1170 }
1171 ASSERT_EQ(keys.size(), value_ptrs.size());
1172 uint64 start = Env::Default()->NowNanos();
1173 for (int64 i = 0; i < keys.size(); i++) {
1174 hashmap->Commit(keys[i], value_ptrs[i]);
1175 }
1176 uint64 end = Env::Default()->NowNanos();
1177 uint64 result_cost = end - start;
1178}
1179
1180void TestCompaction() {
1181 std::string temp_dir = testing::TmpDir();

Callers 1

TestReadEmbFileFunction · 0.85

Calls 7

cpu_allocatorFunction · 0.85
DefaultFunction · 0.85
sizeMethod · 0.45
AllocateRawMethod · 0.45
push_backMethod · 0.45
NowNanosMethod · 0.45
CommitMethod · 0.45

Tested by

no test coverage detected