MCPcopy Create free account
hub / github.com/NVIDIA/MinkowskiEngine / CoordinateMapKey

Class CoordinateMapKey

src/coordinate_map_key.hpp:44–157  ·  view source on GitHub ↗

* Will be exported to python for lazy key initialization. For * instance, `sparse_tensor.coords_key` can be used for other layers * before feedforward */

Source from the content-addressed store, hash-verified

42 * before feedforward
43 */
44class CoordinateMapKey {
45public:
46 // clang-format off
47 using self_type = CoordinateMapKey;
48 using size_type = default_types::size_type;
49 using stride_type = default_types::stride_type;
50 using hash_key_type = default_types::coordinate_map_hash_type;
51 // clang-format on
52
53public:
54 CoordinateMapKey() = delete;
55 CoordinateMapKey(size_type coordinate_size)
56 : m_key_set(false), m_coordinate_size{coordinate_size} {}
57
58 CoordinateMapKey(CoordinateMapKey const &other)
59 : m_key_set(other.m_key_set), m_coordinate_size{other.m_coordinate_size},
60 m_key(other.m_key) {}
61
62 CoordinateMapKey(size_type coordinate_size,
63 coordinate_map_key_type const &key)
64 : m_key_set(true), m_coordinate_size{coordinate_size}, m_key(key) {
65 ASSERT(coordinate_size - 1 == m_key.first.size(),
66 "Invalid tensor_stride:", m_key.first,
67 "coordinate_size:", m_coordinate_size);
68 }
69
70 CoordinateMapKey(stride_type tensor_stride, std::string string_id = "")
71 : m_coordinate_size(tensor_stride.size() + 1), m_key{std::make_pair(
72 tensor_stride,
73 string_id)} {
74 // valid tensor stride if the coordinate_size match
75 m_key = std::make_pair(tensor_stride, string_id);
76 m_key_set = true;
77 }
78
79 // coordinate_size functions
80 size_type get_coordinate_size() const { return m_coordinate_size; }
81
82 // key functions
83 void set_key(stride_type tensor_stride, std::string string_id) {
84 ASSERT(m_coordinate_size - 1 == tensor_stride.size(),
85 "Invalid tensor_stride size:", tensor_stride,
86 "coordinate_size:", m_coordinate_size);
87 m_key = std::make_pair(tensor_stride, string_id);
88 m_key_set = true;
89 }
90
91 void set_key(coordinate_map_key_type const &key) {
92 ASSERT(m_coordinate_size - 1 == key.first.size(),
93 "Invalid tensor_stride size:", key.first,
94 "coordinate_size:", m_coordinate_size);
95 LOG_DEBUG("Setting the key to ", key.first, ":", key.second);
96 m_key = key;
97 m_key_set = true;
98 }
99
100 coordinate_map_key_type get_key() const {
101 ASSERT(is_key_set(), "Key not set");

Callers 15

__init__Method · 0.85
inverse_mappingMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85
__init__Method · 0.85
_get_coordinate_map_keyFunction · 0.85
_binary_functorMethod · 0.85

Calls

no outgoing calls

Tested by 1