Skip to content

Commit

Permalink
Boilerplate for custom HashMap implementation (#373)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
rusty1s and pre-commit-ci[bot] authored Jan 6, 2025
1 parent 50cd40f commit dce9eec
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pyg_lib/csrc/classes/cpu/hash_map.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

#include <torch/library.h>

namespace pyg {
namespace classes {

struct CPUHashMap : torch::CustomClassHolder {
CPUHashMap() {};
};

TORCH_LIBRARY(pyg, m) {
m.class_<CPUHashMap>("CPUHashMap").def(torch::init());
}

} // namespace classes
} // namespace pyg
7 changes: 7 additions & 0 deletions test/csrc/classes/test_hash_map.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <gtest/gtest.h>

#include "pyg_lib/csrc/classes/cpu/hash_map.h"

TEST(CPUHashMapTest, BasicAssertions) {
auto map = pyg::classes::CPUHashMap();
}

0 comments on commit dce9eec

Please sign in to comment.