[Python API] Remove DescriptorTensor constructor (#8903)

This commit is contained in:
Anastasia Kuporosova 2021-12-01 02:09:25 +03:00 committed by GitHub
parent 263c4d7b02
commit 184b602a49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 29 deletions

View File

@ -1,4 +0,0 @@
# Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.pyopenvino import DescriptorTensor as Tensor

View File

@ -22,11 +22,6 @@ void regclass_graph_descriptor_Tensor(py::module m) {
tensor.doc() = "openvino.descriptor.Tensor wraps ov::descriptor::Tensor";
tensor.def(py::init<const ov::element::Type, const ov::PartialShape, const std::string>(),
py::arg("element_type"),
py::arg("partial_shape"),
py::arg("name"));
tensor.def("get_shape",
&ov::descriptor::Tensor::get_shape,
R"(

View File

@ -7,9 +7,21 @@ import pytest
import openvino.runtime.opset8 as ops
from openvino.runtime import Function, Tensor
from openvino.descriptor import Tensor as DescriptorTensor
from openvino.runtime.impl import Type, PartialShape, Shape
from openvino.runtime.impl import PartialShape, Shape
def test_test_descriptor_tensor():
input_shape = PartialShape([1])
param = ops.parameter(input_shape, dtype=np.float32, name="data")
relu1 = ops.relu(param, name="relu1")
relu1.get_output_tensor(0).set_names({"relu_t1"})
td = relu1.get_output_tensor(0)
assert "relu_t1" in td.names
assert td.element_type == Type.f32
assert td.partial_shape == PartialShape([1])
assert repr(td.shape) == "<Shape: {1}>"
assert td.size == 4
assert td.any_name == "relu_t1"
def test_function_add_outputs_tensor_name():
@ -23,7 +35,6 @@ def test_function_add_outputs_tensor_name():
assert len(function.get_results()) == 1
new_outs = function.add_outputs("relu_t1")
assert len(function.get_results()) == 2
assert isinstance(function.outputs[1].get_tensor(), DescriptorTensor)
assert "relu_t1" in function.outputs[1].get_tensor().names
assert len(new_outs) == 1
assert new_outs[0].get_node() == function.outputs[1].get_node()

View File

@ -1,17 +0,0 @@
# Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.descriptor import Tensor
from openvino.runtime.impl import Type, PartialShape
def test_tensor_descriptor_api():
td = Tensor(Type.f32, PartialShape([1, 1, 1, 1]), "tensor_name")
td.names = {"tensor_name"}
assert "tensor_name" in td.names
assert isinstance(td, Tensor)
assert td.element_type == Type.f32
assert td.partial_shape == PartialShape([1, 1, 1, 1])
assert repr(td.shape) == "<Shape: {1, 1, 1, 1}>"
assert td.size == 4
assert td.any_name == "tensor_name"