Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
c1f97a9b
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c1f97a9b
编写于
4月 06, 2023
作者:
R
RedContritio
提交者:
GitHub
4月 06, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support auto generate static for decode_jpeg (#52542)
上级
80dd1672
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
16 addition
and
120 deletion
+16
-120
cmake/operators.cmake
cmake/operators.cmake
+0
-4
paddle/fluid/operators/decode_jpeg_op.cc
paddle/fluid/operators/decode_jpeg_op.cc
+0
-91
paddle/phi/api/yaml/op_compat.yaml
paddle/phi/api/yaml/op_compat.yaml
+6
-0
paddle/phi/api/yaml/static_ops.yaml
paddle/phi/api/yaml/static_ops.yaml
+10
-0
paddle/phi/ops/compat/decode_jpeg_sig.cc
paddle/phi/ops/compat/decode_jpeg_sig.cc
+0
-25
未找到文件。
cmake/operators.cmake
浏览文件 @
c1f97a9b
...
...
@@ -105,9 +105,6 @@ function(op_library TARGET)
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
TARGET
}
.cu
)
list
(
APPEND cu_srcs
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
TARGET
}
.cu
)
endif
()
if
(
WITH_NV_JETSON
)
list
(
REMOVE_ITEM cu_srcs
"decode_jpeg_op.cu"
)
endif
()
if
(
EXISTS
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
TARGET
}
.part.cu
)
set
(
PART_CUDA_KERNEL_FILES
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
TARGET
}
.part.cu
...
...
@@ -308,7 +305,6 @@ function(op_library TARGET)
list
(
REMOVE_ITEM hip_srcs
"eigh_op.cu"
)
list
(
REMOVE_ITEM hip_srcs
"lstsq_op.cu"
)
list
(
REMOVE_ITEM hip_srcs
"multinomial_op.cu"
)
list
(
REMOVE_ITEM hip_srcs
"decode_jpeg_op.cu"
)
hip_library
(
${
TARGET
}
SRCS
${
cc_srcs
}
${
hip_cc_srcs
}
${
miopen_cu_cc_srcs
}
${
miopen_cu_srcs
}
...
...
paddle/fluid/operators/decode_jpeg_op.cc
已删除
100644 → 0
浏览文件 @
80dd1672
// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <fstream>
#include <string>
#include <vector>
#include "paddle/fluid/framework/infershape_utils.h"
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/framework/operator.h"
#include "paddle/fluid/platform/enforce.h"
#include "paddle/phi/core/generator.h"
#include "paddle/phi/core/infermeta_utils.h"
#include "paddle/phi/infermeta/unary.h"
namespace
paddle
{
namespace
operators
{
class
DecodeJpegOp
:
public
framework
::
OperatorWithKernel
{
public:
using
framework
::
OperatorWithKernel
::
OperatorWithKernel
;
protected:
phi
::
KernelKey
GetExpectedKernelType
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
return
phi
::
KernelKey
(
OperatorWithKernel
::
IndicateVarDataType
(
ctx
,
"X"
),
ctx
.
GetPlace
());
}
phi
::
KernelKey
GetKernelTypeForVar
(
const
std
::
string
&
var_name
,
const
phi
::
DenseTensor
&
tensor
,
const
phi
::
KernelKey
&
expected_kernel_type
)
const
override
{
if
(
var_name
==
"X"
)
{
return
phi
::
KernelKey
(
phi
::
Backend
::
ALL_BACKEND
,
expected_kernel_type
.
layout
(),
expected_kernel_type
.
dtype
());
}
return
phi
::
KernelKey
(
tensor
.
place
(),
tensor
.
layout
(),
tensor
.
dtype
());
}
};
class
DecodeJpegOpMaker
:
public
framework
::
OpProtoAndCheckerMaker
{
public:
void
Make
()
override
{
AddInput
(
"X"
,
"A one dimensional uint8 tensor containing the raw bytes "
"of the JPEG image. It is a tensor with rank 1."
);
AddOutput
(
"Out"
,
"The output tensor of DecodeJpeg op"
);
AddComment
(
R"DOC(
This operator decodes a JPEG image into a 3 dimensional RGB Tensor
or 1 dimensional Gray Tensor. Optionally converts the image to the
desired format. The values of the output tensor are uint8 between 0
and 255.
)DOC"
);
AddAttr
<
std
::
string
>
(
"mode"
,
"(string, default
\"
unchanged
\"
), The read mode used "
"for optionally converting the image, can be
\"
unchanged
\"
"
",
\"
gray
\"
,
\"
rgb
\"
."
)
.
SetDefault
(
"unchanged"
);
}
};
}
// namespace operators
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
DECLARE_INFER_SHAPE_FUNCTOR
(
decode_jpeg
,
DecodeJpegInferShapeFunctor
,
PD_INFER_META
(
phi
::
DecodeJpegInferMeta
));
REGISTER_OPERATOR
(
decode_jpeg
,
ops
::
DecodeJpegOp
,
ops
::
DecodeJpegOpMaker
,
paddle
::
framework
::
EmptyGradOpMaker
<
paddle
::
framework
::
OpDesc
>
,
paddle
::
framework
::
EmptyGradOpMaker
<
paddle
::
imperative
::
OpBase
>
,
DecodeJpegInferShapeFunctor
)
paddle/phi/api/yaml/op_compat.yaml
浏览文件 @
c1f97a9b
...
...
@@ -448,6 +448,12 @@
extra
:
attrs
:
[
bool use_mkldnn = false
]
-
op
:
decode_jpeg
inputs
:
x
:
X
outputs
:
out
:
Out
-
op
:
depthwise_conv2d
backward
:
depthwise_conv2d_grad
extra
:
...
...
paddle/phi/api/yaml/static_ops.yaml
浏览文件 @
c1f97a9b
...
...
@@ -57,6 +57,16 @@
func
:
broadcast
param
:
[
x
,
root
]
-
op
:
decode_jpeg
args
:
(Tensor x, str mode = "unchanged")
output
:
Tensor(out)
infer_meta
:
func
:
DecodeJpegInferMeta
param
:
[
x
,
mode
]
kernel
:
func
:
decode_jpeg
param
:
[
x
,
mode
]
-
op
:
embedding
args
:
(Tensor x, Tensor weight, int64_t padding_idx=-1)
output
:
Tensor
...
...
paddle/phi/ops/compat/decode_jpeg_sig.cc
已删除
100644 → 0
浏览文件 @
80dd1672
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "paddle/phi/core/compat/op_utils.h"
namespace
phi
{
KernelSignature
DecodeJpegOpArgumentMapping
(
const
ArgumentMappingContext
&
ctx
)
{
return
KernelSignature
(
"decode_jpeg"
,
{
"X"
},
{
"mode"
},
{
"Out"
});
}
}
// namespace phi
PD_REGISTER_ARG_MAPPING_FN
(
decode_jpeg
,
phi
::
DecodeJpegOpArgumentMapping
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录