Open Honry opened 3 years ago
The root cause should be the OpenVINO backend doesn't support resample 4D tensor in NHWC layout.
This could be reproduced by following test case:
TEST_F(ResampleTests, UpsampleLinearNhwc) {
const std::vector<int32_t> inputShape = {1, 2, 2, 1};
const std::vector<float> inputData = {1, 2, 3, 4};
const std::vector<int32_t> expectedShape = {1, 4, 4, 1};
const std::vector<float> expectedValue = {
1., 1.25, 1.75, 2., 1.5, 1.75, 2.25, 2.5, 2.5, 2.75, 3.25, 3.5, 3., 3.25, 3.75, 4.,
};
ml::ResampleOptions options;
options.mode = ml::InterpolationMode::Linear;
std::vector<float> scales = {1.0, 1.0, 2.0, 2.0};
options.scalesCount = scales.size();
options.scales = scales.data();
TestResample(inputShape, inputData, expectedShape, expectedValue, &options);
options = {};
options.mode = ml::InterpolationMode::Linear;
std::vector<int32_t> sizes = {1, 1, 4, 4};
options.sizesCount = sizes.size();
options.sizes = sizes.data();
TestResample(inputShape, inputData, expectedShape, expectedValue, &options);
}
@fujunwei , could you please send a PR based your solution? Thanks.
Test case: https://github.com/webmachinelearning/webnn-native/pull/52
When test DeepLab sample with NHWC layout and OpenVino backend (Node.js Electron app), we failed to build the graph at
resample
op at following code line:https://github.com/webmachinelearning/webnn-samples/blob/master/semantic_segmentation/deeplabv3_mnv2_nhwc.js#L137.
While this works on DML backend, and NCHW layout also works on OpenVino backend.
Error Log: