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
文章來源:http://www.zghlxwxcb.cn/news/detail-828272.html
References
[1] Yongqiang Cheng, https://yongqiang.blog.csdn.net/文章來源地址http://www.zghlxwxcb.cn/news/detail-828272.html
到了這里,關(guān)于PyCharm 調(diào)試過程中控制臺 (Console) 窗口內(nèi)運行命令 - 實時獲取中間狀態(tài)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!