pytorch取tensor的对角线上的元素

使用 diag()函数。示例如下:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/liu16659/article/details/129340643