Skip to content

Commit

Permalink
[GPU] Handling the case where get_state was called before set_state
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyamin-Roman committed Oct 28, 2024
1 parent 8371289 commit b0391cf
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/plugins/intel_gpu/src/plugin/variable_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,19 @@ ov::element::Type VariableState::get_user_specified_type() const {
}

ov::SoPtr<ov::ITensor> VariableState::get_state() const {
if (m_memory == nullptr) {
const auto& pshape = m_layout.get_partial_shape();
ov::Shape shape;
for (const auto& dim : pshape) {
if (dim.is_static()) {
shape.emplace_back(dim.get_length());
} else {
shape.emplace_back(0ul);
}
}
return m_context->create_host_tensor(get_user_specified_type(), shape);
}

auto tensor = m_context->create_host_tensor(get_user_specified_type(), m_memory->get_layout().get_shape());

convert_and_copy(m_memory, tensor._ptr.get(), m_context->get_engine().get_service_stream());
Expand Down

0 comments on commit b0391cf

Please sign in to comment.