Skip to content

Commit

Permalink
Fix Expected and actual shape are different: [] VS [1]
Browse files Browse the repository at this point in the history
  • Loading branch information
riverlijunjie committed Oct 26, 2023
1 parent a1434d5 commit 6ab4a2f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/core/src/runtime/itensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ size_t ITensor::get_byte_size() const {
}

bool ITensor::is_continuous() const {
if ((get_element_type().bitwidth() < 8) || get_size() == 0) {
if (get_element_type().bitwidth() < 8)
// OpenVINO doesn't support strides for lp types
return true;
}

const auto& shape = get_shape();
const auto& type = get_element_type();
std::vector<size_t> strides(shape.size());
Expand Down
2 changes: 1 addition & 1 deletion src/inference/src/dev/make_tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ViewTensor : public ITensor {
auto& shape = get_shape();
if (m_strides.empty() && !shape.empty()) {
m_strides.resize(shape.size());
m_strides.back() = shape.back() == 0 ? 0 : m_element_type.size();
m_strides.back() = m_element_type.size();
std::transform(shape.crbegin(),
shape.crend() - 1,
m_strides.rbegin(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ DnnlBlockedMemoryDesc MemoryDescUtils::createDnnlBlockedMemoryDesc(InferenceEngi
CpuBlockedMemoryDesc MemoryDescUtils::createCpuBlockedMemoryDesc(const ov::SoPtr<ITensor>& tensor) {
auto element_type = tensor->get_element_type();
auto shape = tensor->get_shape();
if (shape.empty())
shape = {tensor->get_size()};
std::vector<size_t> blk_order(shape.size());
std::iota(blk_order.begin(), blk_order.end(), 0);
std::vector<size_t> dim_offset(shape.size(), 0);
Expand Down

0 comments on commit 6ab4a2f

Please sign in to comment.