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,

相关推荐
Just right19 小时前
pycharm卡死在Connected to pydev debugger
ide·python·pycharm
Irene199119 小时前
(AI总结版)Rich 配置经验总结:PyCharm 终端颜色显示操作指南
python·pycharm
小张同学82419 小时前
[特殊字符]Python 进阶实战指南(PyCharm 专属优化):从高效编码到工程化落地,告别新手低效写法
开发语言·python·pycharm
秉寒-CHO20 小时前
从 PyCharm 到 Cursor:我的 LLM 项目 AI 编程工具链全解析
ide·人工智能·pycharm
WHS-_-20222 天前
Pycharm 使用经验
ide·python·pycharm
Irene19912 天前
PyCharm 终端显示优化
python·pycharm
Irene19912 天前
PyCharm 怎么卸载插件
pycharm
独隅3 天前
PyCharm 开启硬换行的方法
ide·python·pycharm
Irene19913 天前
PyCharm 改字体大小
python·pycharm
Irene19913 天前
配置 PyCharm(汉化版操作指南)
python·pycharm