Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/custom_operations/tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ onnx
tensorboard
pytest
# open3d==0.16.0 - need to update with new release
onnxscript==0.5.4
11 changes: 8 additions & 3 deletions modules/custom_operations/tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,17 @@ def test_fft(shape, inverse, centered, test_onnx, dims):
from examples.fft.export_model import export

if len(shape) == 3 and dims != [1] or \
len(shape) == 4 and dims == [2, 3] or \
len(shape) == 5 and dims == [1] or \
len(shape) == 4 and dims in ([1, 2], [2, 3]) or \
len(shape) == 5 and dims in ([1], [1, 2], [2, 3]) or \
centered and len(dims) != 2:
pytest.skip("unsupported configuration")

if len(shape) == 4 and dims == [1]:
pytest.skip("Custom FFT executed but there is accuracy error, requires FFT::evaluate fix")


inp, ref = export(shape, inverse, centered, dims)
run_test(inp, ref, test_onnx=test_onnx)
run_test(inp, ref, test_onnx=test_onnx)


@pytest.mark.parametrize("shape", [[3, 2, 4, 8, 2], [3, 1, 4, 8, 2]])
Expand Down Expand Up @@ -86,6 +90,7 @@ def test_sparse_conv_transpose(in_channels, filters, kernel_size, out_pos):
run_test(inp, ref, test_onnx=True, threshold=1e-4)


@pytest.mark.skip(reason="Exported model do not contains calculate_grid operator")
def test_calculate_grid():
from examples.calculate_grid.export_model import export
inp, ref = export(num_points=10, max_grid_extent=5)
Expand Down
13 changes: 8 additions & 5 deletions modules/custom_operations/user_ie_extensions/fft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ void FFT::validate_and_infer_types() {
}

std::shared_ptr<ov::Node> FFT::clone_with_new_inputs(const ov::OutputVector& new_args) const {
OPENVINO_ASSERT(new_args.size() == 2, "Incorrect number of new arguments");
const ov::Dimension exp_no_inputs{2};
OPENVINO_ASSERT(exp_no_inputs.compatible(new_args.size()),
"Incorrect number of new arguments, provided: ",
new_args.size());
return std::make_shared<FFT>(new_args, inverse, centered);
}

Expand All @@ -128,15 +131,15 @@ bool FFT::visit_attributes(ov::AttributeVisitor& visitor) {

bool FFT::evaluate(ov::TensorVector& outputs, const ov::TensorVector& inputs) const {
//const_cast because the cvSetData use user pointer as non-const, should be ok as it looks like input data
float *inpData = reinterpret_cast<float *>(const_cast<void*>(inputs[0].data()));
auto *inpData = const_cast<float*>(inputs[0].data<float>());

if (inputs[1].get_element_type() != ov::element::i32)
OPENVINO_THROW("Unexpected dims type: " + inputs[1].get_element_type().to_string());

const int32_t *signalDimsData = reinterpret_cast<const int32_t *>(inputs[1].data());
float* outData = reinterpret_cast<float*>(outputs[0].data());
auto *signalDimsData = inputs[1].data<int32_t>();
auto *outData = outputs[0].data<float>();
std::vector<size_t> dims = inputs[0].get_shape();
const size_t numSignalDims = inputs[1].get_shape()[0];
const size_t numSignalDims = inputs[1].get_shape().empty() ? 1: inputs[1].get_shape().size();

if (!((dims.size() == 3 && numSignalDims == 1 && signalDimsData[0] == 1) ||
(dims.size() == 4 && ((numSignalDims == 1 && signalDimsData[0] == 1) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
# include "fft.hpp"
# define FFT_EXT \
std::make_shared<ov::OpExtension<TemplateExtension::FFT>>(), \
std::make_shared<ov::frontend::OpExtension<TemplateExtension::FFT>>(),
std::make_shared<ov::frontend::OpExtension<TemplateExtension::FFT>>( \
"DFT", \
std::map<std::string, std::string>{ {"centered", "onesided"}, {"inverse", "inverse"} }),
#else
# define FFT_EXT
#endif
Expand Down
4 changes: 2 additions & 2 deletions modules/nvidia_plugin/src/cuda_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model(const std::shared_ptr<
}

std::shared_ptr<ov::ICompiledModel> Plugin::import_model(const ov::Tensor& model, const ov::AnyMap& properties) const {
ov::SharedStreamBuffer buffer{reinterpret_cast<char*>(model.data()), model.get_byte_size()};
ov::SharedStreamBuffer buffer{model.data(), model.get_byte_size()};
std::istream stream{&buffer};
return import_model(stream, properties);
};

std::shared_ptr<ov::ICompiledModel> Plugin::import_model(const ov::Tensor& model,
const ov::SoPtr<ov::IRemoteContext>& context,
const ov::AnyMap& properties) const {
ov::SharedStreamBuffer buffer{reinterpret_cast<char*>(model.data()), model.get_byte_size()};
ov::SharedStreamBuffer buffer{model.data(), model.get_byte_size()};
std::istream stream{&buffer};
return import_model(stream, context, properties);
};
Expand Down
Loading