PyCharm 调试过程中控制台 (Console) 窗口内运行命令 - 实时获取中间状态

PyCharm 调试过程中控制台 Console 窗口内运行命令 - 实时获取中间状态

1. yongqiang.py

复制代码
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# yongqiang cheng
 
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
 
import torch
 
data = torch.randn(4, 4)
print("data:", data)
 
data0 = torch.triu(data)
data1 = torch.triu(data, diagonal=1)
data_1 = torch.triu(data, diagonal=-1)
 
print("data0:\n", data0)
print("data1:\n", data1)
print("data_1:\n", data_1)

/home/yongqiang/miniconda3/envs/pt-1.4_py-3.6/bin/python /home/yongqiang/pytorch_work/end2end-asr-pytorch-example/yongqiang.py
data: tensor([[-1.7405, -1.1455, -0.4935, -0.3035],
        [-0.0731,  0.5049, -0.1989,  0.1956],
        [ 1.5103,  0.5175, -0.7471,  1.3337],
        [-0.5511, -0.7732,  1.4990, -0.1043]])
data0:
 tensor([[-1.7405, -1.1455, -0.4935, -0.3035],
        [ 0.0000,  0.5049, -0.1989,  0.1956],
        [ 0.0000,  0.0000, -0.7471,  1.3337],
        [ 0.0000,  0.0000,  0.0000, -0.1043]])
data1:
 tensor([[ 0.0000, -1.1455, -0.4935, -0.3035],
        [ 0.0000,  0.0000, -0.1989,  0.1956],
        [ 0.0000,  0.0000,  0.0000,  1.3337],
        [ 0.0000,  0.0000,  0.0000,  0.0000]])
data_1:
 tensor([[-1.7405, -1.1455, -0.4935, -0.3035],
        [-0.0731,  0.5049, -0.1989,  0.1956],
        [ 0.0000,  0.5175, -0.7471,  1.3337],
        [ 0.0000,  0.0000,  1.4990, -0.1043]])
 
Process finished with exit code 0

2. Debugger -> Console

​​​

3. Show Python Prompt

References

1 Yongqiang Cheng, https://yongqiang.blog.csdn.net/

相关推荐
Circ.19 小时前
IDEA 引入 nx JAR:原目录可用,复制后失效的原因与解决
pycharm·intellij-idea·jar
勤奋的大熊猫2 天前
PyCharm 内部打开 .gds 版图文件
pycharm·klayout
郝学胜_神的一滴3 天前
Python 高级编程 026:序列内核深剖
python·pycharm
崖边看雾4 天前
Python学习——函数
开发语言·windows·python·学习·pycharm
接针5 天前
Pycharm远程连接Ubuntu的conda环境
ubuntu·pycharm·conda
jiang_changsheng5 天前
详细教程__--PyCharm Terminal--切conda环境详解
ide·pycharm·conda
2601_960906726 天前
科技“无人区”跋涉,难度高、不确定性大
windows·macos·pycharm·myeclipse
Irene19917 天前
怎么设置 PyCharm 使用 VSCode 的快捷键,推荐保留的原生快捷键(特色功能不建议覆盖,否则丧失效率优势)Ctrl+Alt+L:代码格式化
vscode·pycharm·快捷键
ikun_文9 天前
Python进阶—函数编程
python·pycharm
这就是佬们吗9 天前
Python入门⑤-异常处理、文件操作与实战项目
开发语言·数据库·python·算法·pycharm