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

Update tensor pointer cast #952

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
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
10 changes: 5 additions & 5 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
run: python3 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/wheel/requirements-dev.txt

- name: Setup ccache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache@v4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hashes must be used

with:
# Should save cache only if run in the master branch of the base repo
# github.ref_name is 'ref/PR_#' in case of the PR, and 'branch_name' when executed on push
Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
run: |
source ${INSTALL_DIR}/setupvars.sh
gradle clean build --info

for d in CPU HETERO:CPU; do
gradle test -Prun_tests -DMODELS_PATH=${TEST_DATA} -Ddevice=$d --info;
done
Expand All @@ -177,7 +177,7 @@ jobs:
pushd ${INSTALL_DIR}
tar -czvf ${BUILD_DIR}/openvino_package.tar.gz *
popd

pushd ${DEVELOPER_PACKAGE_DIR}
tar -czvf ${BUILD_DIR}/openvino_developer_package.tar.gz *
popd
Expand Down Expand Up @@ -265,7 +265,7 @@ jobs:
pushd ${INSTALL_DIR}
tar -xzf openvino_package.tar.gz -C ${INSTALL_DIR}
popd

pushd ${INSTALL_DIR}
tar -xzf openvino_developer_package.tar.gz -C ${INSTALL_DIR}
popd
Expand All @@ -285,7 +285,7 @@ jobs:
apt -y --no-install-recommends install software-properties-common curl

- name: Setup ccache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache@v4
with:
# Should save cache only if run in the master branch of the base repo
# github.ref_name is 'ref/PR_#' in case of the PR, and 'branch_name' when executed on push
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
#

- name: Setup ccache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache@v4
with:
# Should save cache only if run in the master branch of the base repo
# github.ref_name is 'ref/PR_#' in case of the PR, and 'branch_name' when executed on push
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
Add-Content -Path $env:GITHUB_PATH -Value "C:\ccache"

- name: Setup ccache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache@v4
with:
# Should save cache only if run in the master branch of the base repo
# github.ref_name is 'ref/PR_#' in case of the PR, and 'branch_name' when executed on push
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ std::shared_ptr<ov::Node> CalculateGrid::clone_with_new_inputs(const ov::OutputV
}

bool CalculateGrid::evaluate(ov::TensorVector& outputs, const ov::TensorVector& inputs) const {
const float* inpPos = reinterpret_cast<float*>(inputs[0].data());
const float *inpPos = reinterpret_cast<const float *>(inputs[0].data());
float* out = reinterpret_cast<float*>(outputs[0].data());

std::set<std::tuple<int, int, int> > outPos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ std::shared_ptr<ov::Node> ComplexMultiplication::clone_with_new_inputs(const ov:
}

bool ComplexMultiplication::evaluate(ov::TensorVector& outputs, const ov::TensorVector& inputs) const {
const float* inp0 = reinterpret_cast<float*>(inputs[0].data());
const float* inp1 = reinterpret_cast<float*>(inputs[1].data());
const float *inp0 = reinterpret_cast<const float *>(inputs[0].data());
const float *inp1 = reinterpret_cast<const float *>(inputs[1].data());
float* out = reinterpret_cast<float*>(outputs[0].data());

size_t channels0 = inputs[0].get_shape()[1];
Expand Down
5 changes: 3 additions & 2 deletions modules/custom_operations/user_ie_extensions/fft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,13 @@ bool FFT::visit_attributes(ov::AttributeVisitor& visitor) {
}

bool FFT::evaluate(ov::TensorVector& outputs, const ov::TensorVector& inputs) const {
float* inpData = reinterpret_cast<float*>(inputs[0].data());
//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()));

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

int32_t* signalDimsData = reinterpret_cast<int32_t*>(inputs[1].data());
const int32_t *signalDimsData = reinterpret_cast<const int32_t *>(inputs[1].data());
float* outData = reinterpret_cast<float*>(outputs[0].data());
std::vector<size_t> dims = inputs[0].get_shape();
const size_t numSignalDims = inputs[1].get_shape()[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ std::shared_ptr<ov::Node> GridSample::clone_with_new_inputs(const ov::OutputVect
}

bool GridSample::evaluate(ov::TensorVector& outputs, const ov::TensorVector& inputs) const {
const float* inpData = reinterpret_cast<float*>(inputs[0].data());
const float* gridData = reinterpret_cast<float*>(inputs[1].data());
const float *inpData = reinterpret_cast<const float *>(inputs[0].data());
const float *gridData = reinterpret_cast<const float *>(inputs[1].data());
float* outData = reinterpret_cast<float*>(outputs[0].data());

std::vector<size_t> inpDims = inputs[0].get_shape();
Expand Down
10 changes: 5 additions & 5 deletions modules/custom_operations/user_ie_extensions/sparse_conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ std::shared_ptr<ov::Node> SparseConv::clone_with_new_inputs(const ov::OutputVect
}

bool SparseConv::evaluate(ov::TensorVector& outputs, const ov::TensorVector& inputs) const {
const float* features = reinterpret_cast<float*>(inputs[0].data());
const float* inpPos = reinterpret_cast<float*>(inputs[1].data());
const float* outPos = reinterpret_cast<float*>(inputs[2].data());
const float* kernel = reinterpret_cast<float*>(inputs[3].data());
const float* offset = reinterpret_cast<float*>(inputs[4].data());
const float *features = reinterpret_cast<const float *>(inputs[0].data());
const float *inpPos = reinterpret_cast<const float *>(inputs[1].data());
const float *outPos = reinterpret_cast<const float *>(inputs[2].data());
const float *kernel = reinterpret_cast<const float *>(inputs[3].data());
const float *offset = reinterpret_cast<const float *>(inputs[4].data());
float* out = reinterpret_cast<float*>(outputs[0].data());
memset(out, 0, outputs[0].get_byte_size());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ std::shared_ptr<ov::Node> SparseConvTranspose::clone_with_new_inputs(const ov::O
}

bool SparseConvTranspose::evaluate(ov::TensorVector& outputs, const ov::TensorVector& inputs) const {
const float* features = reinterpret_cast<float*>(inputs[0].data());
const float* inpPos = reinterpret_cast<float*>(inputs[1].data());
const float* outPos = reinterpret_cast<float*>(inputs[2].data());
const float* kernel = reinterpret_cast<float*>(inputs[3].data());
const float* offset = reinterpret_cast<float*>(inputs[4].data());
const float *features = reinterpret_cast<const float *>(inputs[0].data());
const float *inpPos = reinterpret_cast<const float *>(inputs[1].data());
const float *outPos = reinterpret_cast<const float *>(inputs[2].data());
const float *kernel = reinterpret_cast<const float *>(inputs[3].data());
const float *offset = reinterpret_cast<const float *>(inputs[4].data());
float* out = reinterpret_cast<float*>(outputs[0].data());
memset(out, 0, outputs[0].get_byte_size());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void testInputs() {
List<Output> inputs = model.inputs();

assertEquals("data", inputs.get(0).get_any_name());
assertEquals(ElementType.f32, inputs.get(0).get_element_type());
assertEquals(ElementType.f16, inputs.get(0).get_element_type());

int[] shape = new int[] {1, 3, 32, 32};
assertArrayEquals("Shape", shape, inputs.get(0).get_shape());
Expand All @@ -34,7 +34,7 @@ public void testOutputs() {
List<Output> outputs = model.outputs();

assertEquals("fc_out", outputs.get(0).get_any_name());
assertEquals(ElementType.f32, outputs.get(0).get_element_type());
assertEquals(ElementType.f16, outputs.get(0).get_element_type());

int[] shape = new int[] {1, 10};
assertArrayEquals("Shape", shape, outputs.get(0).get_shape());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void testOutputName() {
@Test
public void testOutputType() {
Output output = net.output();
assertEquals("Output element type", ElementType.f32, output.get_element_type());
assertEquals("Output element type", ElementType.f16, output.get_element_type());
}

@Test
Expand Down
Loading