-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OV JS] Add more InferRequest tests and validation (#23747)
### Details: - Create functions for validation in a separate file (_validation.hpp_) - New overload to _cast_to_tensor_ function - Test for scenarios when an object passed to `setInputTensor()` `infer()` `setOutputTensor()` `setTensor()` is not a Tensor. - Remove `Test setInputTensor() - pass number as a single arg` - overlaps with `Test setInputTensor throws when passed object is not a Tensor.` ### Tickets: - *120315*
- Loading branch information
Showing
7 changed files
with
130 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (C) 2018-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#pragma once | ||
#include <napi.h> | ||
|
||
#include "node/include/addon.hpp" | ||
#include "openvino/openvino.hpp" | ||
|
||
/** @brief Checks if Napi::Value is a TensorWrap.*/ | ||
bool is_tensor(const Napi::Env& env, const Napi::Value& value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (C) 2018-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "node/include/type_validation.hpp" | ||
|
||
bool is_tensor(const Napi::Env& env, const Napi::Value& value) { | ||
const auto& prototype = env.GetInstanceData<AddonData>()->tensor; | ||
return value.ToObject().InstanceOf(prototype.Value().As<Napi::Function>()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters