From c7da8602fda4a3392473fe75fbc44f37671a7c65 Mon Sep 17 00:00:00 2001 From: YuanRisheng Date: Wed, 28 Sep 2022 11:05:10 +0800 Subject: [PATCH] add decode_jpeg yaml (#46562) --- paddle/phi/api/yaml/legacy_ops.yaml | 5 ++++- python/paddle/vision/ops.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/paddle/phi/api/yaml/legacy_ops.yaml b/paddle/phi/api/yaml/legacy_ops.yaml index 7f25ba6be48..bca2aeb58a5 100755 --- a/paddle/phi/api/yaml/legacy_ops.yaml +++ b/paddle/phi/api/yaml/legacy_ops.yaml @@ -648,12 +648,15 @@ backward : cumsum_grad - op : decode_jpeg - args : (Tensor x, str mode) + args : (Tensor x, str mode, Place place) output : Tensor(out) infer_meta : func : DecodeJpegInferMeta + param : [x, mode] kernel : func : decode_jpeg + param : [x, mode] + backend : place - op : deformable_conv args : (Tensor x, Tensor offset, Tensor filter, Tensor mask, int[] strides, int[] paddings, int[] dilations, int deformable_groups, int groups, int im2col_step) diff --git a/python/paddle/vision/ops.py b/python/paddle/vision/ops.py index b8a0fa7ee22..11bedb6c317 100755 --- a/python/paddle/vision/ops.py +++ b/python/paddle/vision/ops.py @@ -22,6 +22,7 @@ from ..fluid.initializer import Normal from ..fluid.framework import _non_static_mode, in_dygraph_mode, _in_legacy_dygraph from paddle.common_ops_import import * from paddle import _C_ops, _legacy_C_ops +from ..framework import _current_expected_place __all__ = [ #noqa 'yolo_loss', 'yolo_box', 'deform_conv2d', 'DeformConv2D', @@ -1020,7 +1021,9 @@ def decode_jpeg(x, mode='unchanged', name=None): print(img.shape) """ - if _non_static_mode(): + if in_dygraph_mode(): + return _C_ops.decode_jpeg(x, mode, _current_expected_place()) + elif _non_static_mode(): return _legacy_C_ops.decode_jpeg(x, "mode", mode) inputs = {'X': x} -- GitLab