未验证 提交 06651c48 编写于 作者: Z Zeng Jinle 提交者: GitHub

Fix ut test_pe_fix_op_run_order by using smaller model and batch size (#34603)

* fix ut

* decrease gpu memory consumption

* remove exclusive
上级 68377b44
...@@ -16,7 +16,7 @@ import paddle ...@@ -16,7 +16,7 @@ import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import unittest import unittest
import numpy as np import numpy as np
from paddle.vision.models import resnet50 from paddle.vision.models import resnet18
from paddle.nn import CrossEntropyLoss from paddle.nn import CrossEntropyLoss
...@@ -33,7 +33,7 @@ class TestFixOpRunOrder(unittest.TestCase): ...@@ -33,7 +33,7 @@ class TestFixOpRunOrder(unittest.TestCase):
) else paddle.CPUPlace() ) else paddle.CPUPlace()
def get_feed(self): def get_feed(self):
batch_size = 32 batch_size = 4
image = np.random.random([batch_size, 3, 224, 224]).astype('float32') image = np.random.random([batch_size, 3, 224, 224]).astype('float32')
label = np.random.randint(0, 1000, [batch_size, 1]).astype('int64') label = np.random.randint(0, 1000, [batch_size, 1]).astype('int64')
return {"image": image, "label": label} return {"image": image, "label": label}
...@@ -47,7 +47,7 @@ class TestFixOpRunOrder(unittest.TestCase): ...@@ -47,7 +47,7 @@ class TestFixOpRunOrder(unittest.TestCase):
name="image", shape=[None, 3, 224, 224], dtype="float32") name="image", shape=[None, 3, 224, 224], dtype="float32")
label = paddle.static.data( label = paddle.static.data(
name="label", shape=[None, 1], dtype="int64") name="label", shape=[None, 1], dtype="int64")
model = resnet50() model = resnet18()
pred = model(image) pred = model(image)
loss_fn = CrossEntropyLoss() loss_fn = CrossEntropyLoss()
loss = loss_fn(pred, label) loss = loss_fn(pred, label)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册