OSS contribution wantedgood first issuemodule: bootcamponcall: jit
倉庫指標
- 星標
- (102,472 顆星)
- PR 合併指標
- (平均合併 1天 10小時) (30 天內合併 42 個 PR)
描述
🐛 Bug
During our hackathon today, I ran into this weird error highlighting.
import torch
from typing import Dict
@torch.jit.script
def missing_index(x: Dict[str, int]) -> int:
return x['dne']
missing_index({'item': 20, 'other_item': 120})
This code outputs:
9
10
---> 11 missing_index({'item': 20, 'other_item': 120})
RuntimeError: The following operation failed in the TorchScript interpreter.
Traceback of TorchScript (most recent call last):
File "<ipython-input-6-f7e8ae85d5ad>", line 8, in missing_index
@torch.jit.script
def missing_index(x: Dict[str, int]) -> int:
return x['dne']
~~~~ <--- HERE
RuntimeError: KeyError: dne
I feel like the highlighted range should be either shorter or long enough to highlight the entire statement.
cc @gmagogsfm