Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OV] Fail to build deeplab model with NHWC + OpenVino backend #54

Open
Honry opened this issue Aug 2, 2021 · 2 comments
Open

[OV] Fail to build deeplab model with NHWC + OpenVino backend #54

Honry opened this issue Aug 2, 2021 · 2 comments
Assignees

Comments

@Honry
Copy link
Contributor

Honry commented Aug 2, 2021

Test case: #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:

    const resample0 = this.builder_.resample(
        conv4, {sizes: [1, 65, 65, 256], mode: 'linear'});

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:

Error: Failed to build graph.
    at DeepLabV3MNV2Nhwc.build (deeplabv3_mnv2_nhwc.js:151)
    at main (main.js:334)
    at async window.onload (index.html?undefined:205)
@huningxin huningxin changed the title [IE] Fail to build deeplab model with NHWC + OpenVino backend [OV] Fail to build deeplab model with NHWC + OpenVino backend Aug 9, 2021
@huningxin
Copy link
Collaborator

huningxin commented Aug 9, 2021

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);
}

@huningxin
Copy link
Collaborator

@fujunwei , could you please send a PR based your solution? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants