编辑
ctrl [shift] w选中单词ctrl shift l在打开的文件中选中所有相同的单词alt shift 鼠标左键光标呈一列;alt 鼠标左键取消指定行的光标alt 左右箭头递归返回上次浏览的地方
调试
jupyter
- 调试的快捷键为:
ctrl shift alt enter - 如果跨越不同的
cell进行调试,目前还不能进入,查看不到具体的细节;但是如果是单独的文件,可以通过调试进入。
普通文本模式下的调试
.vscode/launch.json文件的编写
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "TEST", // 为当前调试器命名
"type": "python", // 以哪种解释器执行调试
"request": "launch", // 修改内容对运行时无效
"program": "test_global_track.py", // 指定要以调试运行的程序代码
"console": "integratedTerminal",
"justMyCode": true, // 指定为true的话会跳过某些代码段
"args": [
"--config",
"configs/qg_rcnn_r50_fpn.py",
"--load_from",
"checkpoints/qg_rcnn_r50_fpn_2x_20181010-443129e1.pth",
"--gpus",
"3"
],
"env": {
// "DISPLAY": "10.17.45.7:0.0"
// "DISPLAY": "10.16.61.10:0.0"
}
},
{
"name": "TRAIN", // 为当前调试器命名
"type": "python", // 以哪种解释器执行调试
"request": "launch", // 修改内容对运行时无效
"program": "train_qg_rcnn.py", // 指定要以调试运行的程序代码
"console": "integratedTerminal",
"justMyCode": true, // 指定为true的话会跳过某些代码段
"args": [
"--config",
"configs/qg_rcnn_r50_fpn.py",
"--load_from",
"checkpoints/qg_rcnn_r50_fpn_2x_20181010-443129e1.pth",
"--gpus",
"3"
],
"env": {
// "DISPLAY": "10.17.45.7:0.0"
// "DISPLAY": "10.16.61.10:0.0"
}
}
]
}
- 进入断点调试后,可以在
debug console进行相关变量的显示等调试步骤,在这里,不能通过enter选取提示,只能通过tab选择。如果需要换行,比如:
for x in x:
print(x.shape)
torch.Size([1, 256, 192, 336])
torch.Size([1, 256, 96, 168])
torch.Size([1, 256, 48, 84])
torch.Size([1, 256, 24, 42])
torch.Size([1, 256, 12, 21])
换行使用 shift enter。
在 CALL STACK 栏里可以看到具体的调用流程,在调试的时候如果选择某一个 STACK,会直接进入到调用处,这时就可以打印该调用处中的变量的值等状态信息,直接点击最顶层的 STACK,会回到最终的断点处。
小细节:当前调试所在的代码行为,指定到某一个
STACK为 。