diff --git a/include/onnxruntime/core/framework/tensor_shape.h b/include/onnxruntime/core/framework/tensor_shape.h index 92ef4de0d5..408fafe81f 100644 --- a/include/onnxruntime/core/framework/tensor_shape.h +++ b/include/onnxruntime/core/framework/tensor_shape.h @@ -31,7 +31,7 @@ class TensorShape { TensorShape(gsl::span dims); TensorShape(const std::vector& dims) : TensorShape(gsl::make_span(dims)) {} - TensorShape(const std::initializer_list& dims) : TensorShape(gsl::make_span(dims)) {} + TensorShape(const std::initializer_list& dims) : TensorShape(gsl::make_span(dims.begin(), dims.end())) {} TensorShape(const int64_t* dimension_sizes, size_t dimension_count) : TensorShape(gsl::span(dimension_sizes, dimension_count)) {} TensorShape(const std::vector& dims, size_t start, size_t end) : TensorShape(gsl::span(&dims[start], end - start)) {} @@ -57,7 +57,7 @@ class TensorShape { Copy dims into an array with given size */ void CopyDims(int64_t* dims, size_t num_dims) const { - memcpy(dims, values_.begin(), sizeof(int64_t) * std::min(num_dims, NumDimensions())); + memcpy(dims, values_.data(), sizeof(int64_t) * std::min(num_dims, NumDimensions())); } /** @@ -66,7 +66,7 @@ class TensorShape { and this function does no checks to ensure that */ void CopyDims(int64_t* dims, size_t start_dim, size_t num_dims) const { - memcpy(dims, values_.begin() + start_dim, sizeof(int64_t) * std::min(num_dims, NumDimensions() - start_dim)); + memcpy(dims, values_.data() + start_dim, sizeof(int64_t) * std::min(num_dims, NumDimensions() - start_dim)); } /** diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/MLOperatorAuthorImpl.cpp b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/MLOperatorAuthorImpl.cpp index 85017f0a05..7a61f56eb6 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/MLOperatorAuthorImpl.cpp +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/MLOperatorAuthorImpl.cpp @@ -1507,7 +1507,7 @@ std::vector OpKernelContextWrapper::GetOutputTensors(const E std::vector ret; ret.reserve(m_outputTensors.size()); - ORT_THROW_HR_IF(E_INVALIDARG, m_impl->OutputCount() != outputShapes.EdgeCount()); + ORT_THROW_HR_IF(E_INVALIDARG, static_cast(m_impl->OutputCount()) != outputShapes.EdgeCount()); for (int i = 0; i < m_impl->OutputCount(); ++i) { ComPtr tensor; @@ -1847,7 +1847,7 @@ void InferAndVerifyOutputSizes( if (tensorType.has_shape()) { const auto& shape = tensorType.shape(); - ML_CHECK_BOOL(shape.dim_size() == outputShapes.GetShape(outputIndex).size()); + ML_CHECK_BOOL(static_cast(shape.dim_size()) == outputShapes.GetShape(outputIndex).size()); for (uint32_t output_dim = 0; output_dim < outputShapes.GetShape(outputIndex).size(); ++output_dim) { if (shape.dim(output_dim).has_dim_value()) { diff --git a/onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorHelper.cpp b/onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorHelper.cpp index f3b9ddceb2..1e7f1be00b 100644 --- a/onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorHelper.cpp +++ b/onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorHelper.cpp @@ -1335,7 +1335,7 @@ namespace OperatorHelper auto inputShape = shapeInfo.GetInputTensorShape(i); for (size_t j = 0; j < outputShape.size(); ++j) { - if (m_axis == j) + if (static_cast(m_axis) == j) { outputShape[j] += inputShape[j]; } diff --git a/onnxruntime/core/providers/dml/dml_provider_factory.cc b/onnxruntime/core/providers/dml/dml_provider_factory.cc index 9b3df2bf7f..704fb99c1b 100644 --- a/onnxruntime/core/providers/dml/dml_provider_factory.cc +++ b/onnxruntime/core/providers/dml/dml_provider_factory.cc @@ -212,6 +212,7 @@ static constexpr OrtDmlApi ort_dml_api_10_to_x = { const OrtDmlApi* GetOrtDmlApi(_In_ uint32_t /*version*/) NO_EXCEPTION { #ifdef USE_DML return &ort_dml_api_10_to_x; -#endif // USE_DML - return nullptr; +#else + return nullptr; +#endif } \ No newline at end of file