paddle.rand 输出全是0
收藏
我在对paddle API 进行学习时候出现 paddle.rand 输出全是0 情况请问是什么原因导致的?
import paddle
# example 1: attr shape is a list which doesn't contain Tensor.
out1 = paddle.rand(shape=[2, 3]).numpy()*100
out4 = paddle.randn(shape=[2, 3])
# example 2: attr shape is a list which contains Tensor.
dim1 = paddle.to_tensor([2], 'int64')
dim2 = paddle.to_tensor([3], 'int32')
out2 = paddle.rand(shape=[dim1, dim2, 2])shape_tensor = paddle.to_tensor([2, 3])
out3 = paddle.rand(shape_tensor)
输出out1,out2,out3,out4 所有的数据都为0
环境为
Please NOTE: device: 0, GPU Compute Capability: 5.0, Driver API Version: 12.0, Runtime API Version: 11.2
W0505 21:01:24.236230 17196 gpu_resources.cc:91] device: 0, cuDNN Version: 8.2.
0
收藏
请登录后评论
不是0
import paddle
out4 = paddle.randn(shape=[2, 3])
print(out4)
Tensor(shape=[2, 3], dtype=float32, place=Place(gpu:0), stop_gradient=True,
[[-0.83749163, -0.90731597, 0.41067493],
[ 0.93938386, 1.60379386, -0.00137649]])
顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶
出现一样情况 cuda11.2 paddle 2.3.2以后版本,随机数gpu下全0 。gaussian_random都是0 设备选cpu就正常可以随机也不知道什么问题。gpu下Tensor.cpu()也Pirnt全0