Skip to content

Commit

Permalink
[GPU] Handling the case where get_state was called before set_state (o…
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyamin-Roman authored Oct 31, 2024
1 parent 689e043 commit 2e87aad
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 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,12 @@ 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();
const auto& shape = get_tensor_shape(pshape);
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 2e87aad

Please sign in to comment.