未验证 提交 885e8855 编写于 作者: P Peihan 提交者: GitHub

resolve inference_pass_test input lodtensor case, test=develop (#25541)

* refine infer ir pass tests, test=develop

* commit to change copy_from_cpu input to np array, test=develop
上级 0d8545f8
......@@ -78,7 +78,10 @@ class InferencePassTest(unittest.TestCase):
shape = tensor_shapes[name]
shape[0] = 1
tensor = predictor.get_input_tensor(name)
tensor.copy_from_cpu(list(self.feeds.values())[i])
feed_data = list(self.feeds.values())[i]
tensor.copy_from_cpu(np.array(feed_data))
if type(feed_data) == fluid.LoDTensor:
tensor.set_lod(feed_data.lod())
predictor.zero_copy_run()
......
......@@ -44,7 +44,8 @@ class ConvElementwiseAdd2ActFusePassTest(InferencePassTest):
def test_check_output(self):
if core.is_compiled_with_cuda():
self.check_output_with_option([True])
use_gpu = True
self.check_output_with_option(use_gpu)
if __name__ == "__main__":
......
......@@ -46,7 +46,8 @@ class ConvElementwiseAddActFusePassTest(InferencePassTest):
def test_check_output(self):
if core.is_compiled_with_cuda():
self.check_output_with_option([True])
use_gpu = True
self.check_output_with_option(use_gpu)
if __name__ == "__main__":
......
......@@ -42,7 +42,8 @@ class ConvElementwiseAddFusePassTest(InferencePassTest):
def test_check_output(self):
if core.is_compiled_with_cuda():
self.check_output_with_option([True])
use_gpu = True
self.check_output_with_option(use_gpu)
if __name__ == "__main__":
......
......@@ -42,7 +42,8 @@ class TransposeFlattenConcatFusePassTest(InferencePassTest):
def test_check_output(self):
# There is no cpu pass for transpose_flatten_concat_fuse
if core.is_compiled_with_cuda():
self.check_output_with_option([True])
use_gpu = True
self.check_output_with_option(use_gpu)
if __name__ == "__main__":
......
......@@ -48,7 +48,8 @@ class TransposeFlattenConcatFusePassTRTTest(InferencePassTest):
def test_check_output(self):
# There is no cpu pass for transpose_flatten_concat_fuse
if core.is_compiled_with_cuda():
self.check_output_with_option([True])
use_gpu = True
self.check_output_with_option(use_gpu)
if __name__ == "__main__":
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册