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/

相关推荐
emo_2b10 小时前
Pycharm配置conda解释器时遇到的问题及解决方法
linux·pycharm·conda
小园子的小菜1 天前
FastAPI 全方位入门实战:高性能 Python Web 框架开发指南
python·pycharm·fastapi
天蓝蓝的本我4 天前
conda日常用到的命令积累1-登录linux,安装pycharm
linux·pycharm·conda
郝学胜-神的一滴4 天前
AI 编程智能体 05:拆解智能体分级体系、类型与全行业落地场景
开发语言·人工智能·python·程序人生·pycharm
郝学胜-神的一滴8 天前
AI 编程智能体 02:AI智能体到底是什么
开发语言·人工智能·python·程序人生·pycharm
梦幻通灵11 天前
IDEA导入外部Jar包进行反编译
pycharm·intellij-idea·jar
happylifetree11 天前
Python06-08:Python开发工具PyCharm安装
python·pycharm
life码农12 天前
PhpStorm或Pycharm中 如何从某个位置全选文字到文件末尾
ide·pycharm·phpstorm
happylifetree12 天前
Python06(补充4):PyCharm里的删除
python·pycharm