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,

相关推荐
桃气媛媛3 小时前
Pycharm常用快捷键
python·pycharm
szcsun55 小时前
关于在pycharm中新建项目创建虚拟化环境venv
ide·python·pycharm
小白学大数据13 小时前
如何判断网站流量飙升是搜索引擎爬虫导致的?
爬虫·scrapy·搜索引擎·pycharm
冰箱太凉2 天前
idea通过本地jar调试远程服务
pycharm·intellij-idea·jar
hutengyi4 天前
SpringBoot项目中读取resource目录下的文件(六种方法)
spring boot·python·pycharm
chushiyunen4 天前
pycharm实现skills示例
windows·python·pycharm
shughui5 天前
Miniconda下载、安装、关联配置 PyCharm(2026最新图文教程)
ide·python·pycharm·miniconda
chushiyunen6 天前
pycharm创建桌面时间控件小程序
ide·小程序·pycharm
在屏幕前出油6 天前
02. FastAPI——路由
服务器·前端·后端·python·pycharm·fastapi
AI+程序员在路上6 天前
在pyCharm 中命令打包生成exe文件方法
ide·python·pycharm