Commit 0405a870 authored by shssf's avatar shssf Committed by Robert Kimball

IntelGPU backend: Allow zero size Shape (#1332)

parent 8009b475
...@@ -82,16 +82,22 @@ cldnn::tensor runtime::intelgpu::IntelGPULayout::create_cldnn_tensor(const Shape ...@@ -82,16 +82,22 @@ cldnn::tensor runtime::intelgpu::IntelGPULayout::create_cldnn_tensor(const Shape
{ {
vector<size_t> idx(4, 1); vector<size_t> idx(4, 1);
size_t index = 0; size_t index = 0;
const size_t total_zise = shape_size<Shape>(element_shape);
for (auto i = element_shape.crbegin(); i != element_shape.crend() && index < 3; ++i, ++index) // clDNN requires at least scalar tensor size. We can't create zero sized tensors
if (total_zise != 0)
{ {
idx.at(index) = *i; for (auto i = element_shape.crbegin(); i != element_shape.crend() && index < 3;
} ++i, ++index)
{
idx.at(index) = *i;
}
if (element_shape.size() > 3) if (element_shape.size() > 3)
{ {
idx.at(3) = idx.at(3) = accumulate(
accumulate(element_shape.rbegin() + 3, element_shape.rend(), 1, multiplies<size_t>()); element_shape.rbegin() + 3, element_shape.rend(), 1, multiplies<size_t>());
}
} }
//Parameters for this ctor: batch, feature, spatial_x, spatial_y //Parameters for this ctor: batch, feature, spatial_x, spatial_y
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment