We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用Paddle-gpu 20241016的daily包,运行下述代码出现如下报错,使用Paddle-gpu 3.0beta则可以正常运行。 测试代码: import os import unittest
import numpy as np
import paddle from paddle import base from paddle.base import core
SEED = 2021
class TestReduceSumNet(unittest.TestCase):
def set_reduce_sum_function(self, x): # keep_dim = False return paddle.sum(x, axis=-1) def _test(self, run_cuda=True): main_prog = paddle.static.Program() startup_prog = paddle.static.Program() main_prog.random_seed = SEED startup_prog.random_seed = SEED np.random.seed(SEED) a_np = np.random.random(size=(2, 3, 4)).astype('float32') b_np = np.random.random(size=(2, 3, 4)).astype('float32') label_np = np.random.randint(2, size=(2, 1)).astype('int64') with paddle.static.program_guard(main_prog, startup_prog): a = paddle.static.data(name="a", shape=[2, 3, 4], dtype='float32') b = paddle.static.data(name="b", shape=[2, 3, 4], dtype='float32') label = paddle.static.data(name="label", shape=[2, 1], dtype='int64') a_1 = paddle.static.nn.fc(x=a, size=4, num_flatten_dims=2, activation=None) b_1 = paddle.static.nn.fc(x=b, size=4, num_flatten_dims=2, activation=None) z = paddle.add(a_1, b_1) z_1 = self.set_reduce_sum_function(z) prediction = paddle.static.nn.fc(x=z_1, size=2, activation='softmax') cost = paddle.nn.functional.cross_entropy(input=prediction, label=label) loss = paddle.mean(cost) sgd = paddle.optimizer.Momentum(learning_rate=0.01) sgd.minimize(loss) if run_cuda: place = core.CUDAPlace(0) else: place = paddle.CPUPlace() exe = paddle.static.Executor(place) exe.run(startup_prog) print("Start run on {}".format(place)) for epoch in range(100): pred_res, loss_res = exe.run(main_prog, feed={ "a": a_np, "b": b_np, "label": label_np }, fetch_list=[prediction, loss]) if epoch % 10 == 0: print("Epoch {} | Prediction[0]: {}, Loss: {}".format( epoch, pred_res[0], loss_res)) return pred_res, loss_res def test_cuda(self): cuda_pred, cuda_loss = self._test(True) cpu_pred, cpu_loss = self._test(False) self.assertTrue(np.allclose(cuda_pred, cpu_pred)) self.assertTrue(np.allclose(cuda_loss, cpu_loss))
if name == 'main': paddle.enable_static() unittest.main()
No response
The text was updated successfully, but these errors were encountered:
这是框架的一个 bug,已提交修复 PR:https://github.com/PaddlePaddle/Paddle/pull/68806/files
Sorry, something went wrong.
zhangbo9674
No branches or pull requests
bug描述 Describe the Bug
使用Paddle-gpu 20241016的daily包,运行下述代码出现如下报错,使用Paddle-gpu 3.0beta则可以正常运行。
测试代码:
import os
import unittest
import numpy as np
import paddle
from paddle import base
from paddle.base import core
SEED = 2021
class TestReduceSumNet(unittest.TestCase):
if name == 'main':
paddle.enable_static()
unittest.main()
其他补充信息 Additional Supplementary Information
No response
The text was updated successfully, but these errors were encountered: