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,

相关推荐
G***T6913 天前
GitGraphQL案例
pycharm·perl·etl
努力成为大牛吧3 天前
Pycharm 接入 Deepseek API完整版教程
ide·python·pycharm
岚天start3 天前
Java程序生成Heap Dump堆内存快照文件的多种方法
开发语言·python·pycharm
万粉变现经纪人4 天前
如何解决 pip install 编译报错 ‘cl.exe’ not found(缺少 VS C++ 工具集)问题
开发语言·c++·人工智能·python·pycharm·bug·pip
梁辰兴4 天前
PyCharm使用了Conda的虚拟环境创建的的Python项目,下载库(包)到该项目的虚拟环境中
python·pycharm·conda·错误·异常·异常报错
m0_528489256 天前
Pycharm修改系统缓存路径(包含config, system, plugins, logs, remote sources等)
ide·python·pycharm·c盘
中医正骨葛大夫6 天前
一文解决如何在Pycharm中创建cuda深度学习环境?
pytorch·深度学习·pycharm·软件安装·cuda·anaconda·配置环境
Franklin6 天前
AI Coding 基础实践03 - Trae AI在Pycharm中的使用02 - 读取不了项目的文件问题解决
ide·python·pycharm
帮帮志6 天前
PyCharm 开发工具 不同的模式
ide·python·pycharm
趙卋傑6 天前
接口自动化测试
python·pycharm·pytest