File tree Expand file tree Collapse file tree
torch/csrc/jit/codegen/cuda Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,14 @@ namespace torch {
1414namespace jit {
1515namespace fuser {
1616
17+ // https://stackoverflow.com/questions/18837857/cant-use-enum-class-as-unordered-map-key
18+ struct TypeHash {
19+ template <typename T>
20+ std::size_t operator ()(T t) const {
21+ return static_cast <std::size_t >(t);
22+ }
23+ };
24+
1725/*
1826 * Usage: FusionGuard and Fusion are required user interfaces for any operation
1927 * underlying the code generator. In order to create values, expressions, and
@@ -175,7 +183,7 @@ struct TORCH_CUDA_API Fusion : public IRInputOutput {
175183 StmtNameType getExprName ();
176184
177185 // map from valtype to individual name counters
178- std::unordered_map<ValType, StmtNameType> val_type_name_map = {
186+ std::unordered_map<ValType, StmtNameType, TypeHash > val_type_name_map = {
179187 {ValType::TensorView, 0 },
180188 {ValType::TensorDomain, 0 },
181189 {ValType::IterDomain, 0 },
You can’t perform that action at this time.
0 commit comments