DML EP temporarily fall back to CPU for LayerNorm when Bias is not present (#12987)

* Temporarily fall back to CPU for LayerNorm

* Build fix

* Typo

* TYPO

Co-authored-by: Sumit Agarwal <sumitagarwal@microsoft.com>
This commit is contained in:
sumitsays 2022-09-15 16:13:18 -07:00 committed by GitHub
parent 9f6646f11d
commit 709254949a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -54,14 +54,17 @@ public:
void CALLBACK QueryLayerNormalization(IMLOperatorSupportQueryContextPrivate* context, /*out*/ bool* isSupported)
{
*isSupported = true;
*isSupported = false;
// Mean and InvStdDev are not supported outputs.
if (context->GetOutputCount() > 1)
// If only Scale tensor is present then fall back to CPU. This is temporary until
// DML1.9.2 or DML1.10 gets released.
if (context->GetInputCount() < 3 || context->GetOutputCount() > 1)
{
*isSupported = false;
return;
}
*isSupported = true;
}
DML_OP_DEFINE_CREATION_FUNCTION(LayerNormalization, DmlOperatorLayerNormalization);

View file

@ -592,7 +592,7 @@ namespace OperatorHelper
int32_t transBatch,
int32_t transpose)
{
const uint32_t dimensionCount = sizes.size();
const uint32_t dimensionCount = gsl::narrow_cast<uint32_t>(sizes.size());
std::vector<uint32_t> newStrides(dimensionCount);
std::vector<uint32_t> newSizes(sizes.begin(), sizes.end());