Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Thiago Crepaldi committed Apr 5, 2023
1 parent eb2377d commit 17c12b9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion torch/csrc/jit/passes/peephole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,11 @@ struct PeepholeOptimizeImpl {
if (string_type) {
WithInsertPoint guard(node);
std::string type_str = node->inputs().at(0)->node()->s(attr::value);
auto index = toIValue(node->inputs().at(1))->toInt();
auto maybe_index = toIValue(node->inputs().at(1));
int64_t index = 0;
if (maybe_index) {
index = maybe_index->toInt();
}
auto device = c10::Device(type_str + ":" + std::to_string(index));
auto output = node->owningGraph()->insertConstant(device);
GRAPH_UPDATE(
Expand Down

0 comments on commit 17c12b9

Please sign in to comment.