Skip to content

Commit 4ec5940

Browse files
authored
Avoid torch.meshgrid user warning (d2l-ai#1174)
Avoids the following user warning: ```python ~/anaconda3/envs/torch/lib/python3.10/site-packages/torch/functional.py:568: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:2228.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] ```
1 parent 9bd0378 commit 4ec5940

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

chapter_computer-vision/anchor.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def multibox_prior(data, sizes, ratios):
109109
# 生成锚框的所有中心点
110110
center_h = (torch.arange(in_height, device=device) + offset_h) * steps_h
111111
center_w = (torch.arange(in_width, device=device) + offset_w) * steps_w
112-
shift_y, shift_x = torch.meshgrid(center_h, center_w)
112+
shift_y, shift_x = torch.meshgrid(center_h, center_w, indexing='ij')
113113
shift_y, shift_x = shift_y.reshape(-1), shift_x.reshape(-1)
114114
115115
# 生成“boxes_per_pixel”个高和宽,

0 commit comments

Comments
 (0)