>>> import torch
>>> torch.manual_seed(seed=20200910)
<torch._C.Generator object at 0x000001FB002DD330>
>>> a = torch.randn(3,4)
>>> b = a
>>> a
tensor([[ 0.2824, -0.3715, 0.9088, -1.7601],
[-0.1806, 2.0937, 1.0406, -1.7651],
[ 1.1216, 0.8440, 0.1783, 0.6859]])
>>> b
tensor([[ 0.2824, -0.3715, 0.9088, -1.7601],
[-0.1806, 2.0937, 1.0406, -1.7651],
[ 1.1216, 0.8440, 0.1783, 0.6859]])
>>> a.fill_(20200910.0)
tensor([[20200910., 20200910., 20200910., 20200910.],
[20200910., 20200910., 20200910., 20200910.],
[20200910., 20200910., 20200910., 20200910.]])
>>> a
tensor([[20200910., 20200910., 20200910., 20200910.],
[20200910., 20200910., 20200910., 20200910.],
[20200910., 20200910., 20200910., 20200910.]])
>>> b
tensor([[20200910., 20200910., 20200910., 20200910.],
[20200910., 20200910., 20200910., 20200910.],
[20200910., 20200910., 20200910., 20200910.]])
>>>
>>>
>>>
03-07
9297
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-09
5168
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-18
8万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交