-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WebGPU EP] Support Shape operator (#22095)
### Description Shape operator ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. -->
- Loading branch information
1 parent
c3086d6
commit c5cf2ab
Showing
2 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
#include "core/providers/webgpu/webgpu_kernel.h" | ||
#include "core/providers/webgpu/webgpu_supported_types.h" | ||
#include "core/providers/cpu/tensor/shape_op.h" | ||
|
||
namespace onnxruntime { | ||
namespace webgpu { | ||
|
||
ONNX_OPERATOR_VERSIONED_KERNEL_EX( | ||
Shape, | ||
kOnnxDomain, | ||
1, 12, | ||
kWebGpuExecutionProvider, | ||
(*KernelDefBuilder::Create()) | ||
.OutputMemoryType(OrtMemTypeCPU, 0) | ||
.TypeConstraint("T", WebGpuSupportedNumberTypes()) | ||
.TypeConstraint("T1", DataTypeImpl::GetTensorType<int64_t>()), | ||
Shape); | ||
|
||
ONNX_OPERATOR_VERSIONED_KERNEL_EX( | ||
Shape, | ||
kOnnxDomain, | ||
13, 14, | ||
kWebGpuExecutionProvider, | ||
(*KernelDefBuilder::Create()) | ||
.OutputMemoryType(OrtMemTypeCPU, 0) | ||
.TypeConstraint("T", WebGpuSupportedNumberTypes()) | ||
.TypeConstraint("T1", DataTypeImpl::GetTensorType<int64_t>()), | ||
Shape); | ||
|
||
ONNX_OPERATOR_VERSIONED_KERNEL_EX( | ||
Shape, | ||
kOnnxDomain, | ||
15, 18, | ||
kWebGpuExecutionProvider, | ||
(*KernelDefBuilder::Create()) | ||
.OutputMemoryType(OrtMemTypeCPU, 0) | ||
.TypeConstraint("T", WebGpuSupportedNumberTypes()) | ||
.TypeConstraint("T1", DataTypeImpl::GetTensorType<int64_t>()), | ||
Shape); | ||
|
||
ONNX_OPERATOR_VERSIONED_KERNEL_EX( | ||
Shape, | ||
kOnnxDomain, | ||
19, 20, | ||
kWebGpuExecutionProvider, | ||
(*KernelDefBuilder::Create()) | ||
.OutputMemoryType(OrtMemTypeCPU, 0) | ||
.TypeConstraint("T", WebGpuSupportedNumberTypes()) | ||
.TypeConstraint("T1", DataTypeImpl::GetTensorType<int64_t>()), | ||
Shape); | ||
|
||
ONNX_OPERATOR_VERSIONED_KERNEL_EX( | ||
Shape, | ||
kOnnxDomain, | ||
21, 22, | ||
kWebGpuExecutionProvider, | ||
(*KernelDefBuilder::Create()) | ||
.OutputMemoryType(OrtMemTypeCPU, 0) | ||
.TypeConstraint("T", WebGpuSupportedNumberTypes()) | ||
.TypeConstraint("T1", DataTypeImpl::GetTensorType<int64_t>()), | ||
Shape); | ||
|
||
ONNX_OPERATOR_KERNEL_EX( | ||
Shape, | ||
kOnnxDomain, | ||
23, | ||
kWebGpuExecutionProvider, | ||
(*KernelDefBuilder::Create()) | ||
.OutputMemoryType(OrtMemTypeCPU, 0) | ||
.TypeConstraint("T", WebGpuSupportedNumberTypes()) | ||
.TypeConstraint("T1", DataTypeImpl::GetTensorType<int64_t>()), | ||
Shape); | ||
|
||
} // namespace webgpu | ||
} // namespace onnxruntime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters