码迷,mamicode.com
首页 > 其他好文 > 详细

torch.eye

时间:2019-01-21 21:06:36      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:optional   其它   tps   href   位置   att   float   str   htm   

torch.eye

torch.eye(n, m=None, out=None)

返回一个2维张量,对角线位置全1,其它位置全0

  • n (int ) – 行数
  • m (int, optional) – 列数.如果为None,则默认为n
  • out (Tensor, optinal) - Output tensor

返回值: 对角线位置全1,其它位置全0的2维张量

返回值类型: Tensor

例子:

>>> torch.eye(3)

1 0 0

0 1 0

0 0 1

[torch.FloatTensor of size 3x3]

torch.eye

标签:optional   其它   tps   href   位置   att   float   str   htm   

原文地址:https://www.cnblogs.com/btschang/p/10300727.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!