Skip to content

Commit

Permalink
[DirectML] Register Pad19 (#19175)
Browse files Browse the repository at this point in the history
### Description
Register Pad19 in DirectML

---------

Co-authored-by: Sheil Kumar <[email protected]>
  • Loading branch information
smk2007 and Sheil Kumar authored Jan 24, 2024
1 parent d7aebf9 commit a39ac4a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ class DmlOperatorPadding : public DmlOperator, public PaddingHelper
{
mode = DML_PADDING_MODE_REFLECTION;
}
#if DML_TARGET_VERSION >= 0x6300
else if (modeString == AttrValue::Wrap)
{
mode = DML_PADDING_MODE_WRAP;
}
#endif
else
{
ML_INVALID_ARGUMENT("Unknown Pad mode attribute.");
Expand Down Expand Up @@ -116,5 +122,6 @@ DML_OP_DEFINE_CREATION_FUNCTION(Pad7, VersionedKernel<DmlOperatorPadding, 7>);
DML_OP_DEFINE_CREATION_FUNCTION(Pad11, VersionedKernel<DmlOperatorPadding, 11>);
DML_OP_DEFINE_CREATION_FUNCTION(Pad13, VersionedKernel<DmlOperatorPadding, 13>);
DML_OP_DEFINE_CREATION_FUNCTION(Pad18, VersionedKernel<DmlOperatorPadding, 18>);
DML_OP_DEFINE_CREATION_FUNCTION(Pad19, VersionedKernel<DmlOperatorPadding, 19>);

} // namespace Dml
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ DML_OP_EXTERN_CREATION_FUNCTION(Pad7);
DML_OP_EXTERN_CREATION_FUNCTION(Pad11);
DML_OP_EXTERN_CREATION_FUNCTION(Pad13);
DML_OP_EXTERN_CREATION_FUNCTION(Pad18);
DML_OP_EXTERN_CREATION_FUNCTION(Pad19);
DML_OP_EXTERN_CREATION_FUNCTION(SpaceToDepth);
DML_OP_EXTERN_CREATION_FUNCTION(DepthToSpace);
DML_OP_EXTERN_CREATION_FUNCTION(Sqrt);
Expand Down Expand Up @@ -747,6 +748,11 @@ constexpr static OperatorRegistrationInformation operatorRegistrationInformation
{REG_INFO_VER( 11, Pad, typeNameListDefault, supportedTypeListAllScalars, DmlGraphSupport::Supported, requiredConstantCpuInputs(1, 2) /*pads, value*/)}, // https://microsoft.visualstudio.com/OS/_workitems/edit/26007728
{REG_INFO_VER( 13, Pad, typeNameListDefault, supportedTypeListAllScalars, DmlGraphSupport::Supported, requiredConstantCpuInputs(1, 2) /*pads, value*/)}, // https://microsoft.visualstudio.com/OS/_workitems/edit/26007728
{REG_INFO_VER( 18, Pad, typeNameListDefault, supportedTypeListAllScalars, DmlGraphSupport::Supported, requiredConstantCpuInputs(1, 2, 3) /*pads, value, axes*/)},

#if DML_TARGET_VERSION >= 0x6300
{REG_INFO_VER( 19, Pad, typeNameListDefault, supportedTypeListAllScalars, DmlGraphSupport::Supported, requiredConstantCpuInputs(1, 2, 3) /*pads, value, axes*/)},
#endif

{REG_INFO( 7, SpaceToDepth, typeNameListDefault, supportedTypeListAllScalars, DmlGraphSupport::Supported)},
{REG_INFO( 13, SpaceToDepth, typeNameListDefault, supportedTypeListAllScalars, DmlGraphSupport::Supported)},
{REG_INFO( 7, DepthToSpace, typeNameListDefault, supportedTypeListAllScalars, DmlGraphSupport::Supported)},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,6 @@ namespace AttrValue
static constexpr const char* NearestNeighbor = "NN";
static constexpr const char* NotSet = "NOTSET";
static constexpr const char* Reflect = "reflect";
static constexpr const char* Wrap = "wrap";

} // namespace AttrValue
Original file line number Diff line number Diff line change
Expand Up @@ -1589,6 +1589,7 @@ using ShapeInferenceHelper_Pad7 = VersionedOpsetHelper<PaddingHelper, 7>;
using ShapeInferenceHelper_Pad11 = VersionedOpsetHelper<PaddingHelper, 11>;
using ShapeInferenceHelper_Pad13 = VersionedOpsetHelper<PaddingHelper, 13>;
using ShapeInferenceHelper_Pad18 = VersionedOpsetHelper<PaddingHelper, 18>;
using ShapeInferenceHelper_Pad19 = VersionedOpsetHelper<PaddingHelper, 19>;

using ShapeInferenceHelper_SpaceToDepth = SpaceToDepthHelper;
using ShapeInferenceHelper_DepthToSpace = DepthToSpaceHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ namespace OperatorHelper
namespace OnnxOperatorSet19
{
static const int sc_sinceVer_AveragePool = 19;
static const int sc_sinceVer_Pad = 19;
static const int sc_sinceVer_Cast = 19;
static const int sc_sinceVer_CastLike = 19;
static const int sc_sinceVer_Constant = 19;
Expand Down

0 comments on commit a39ac4a

Please sign in to comment.