1 // Copyright (C) 2018-2020 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
6 * @brief a header file for IMemoryState interface
8 * @file ie_imemory_state.hpp
14 #include "details/ie_no_copy.hpp"
16 #include "ie_common.h"
18 namespace InferenceEngine {
21 * @brief manages data for reset operations
23 class IMemoryState : public details::no_copy {
25 using Ptr = std::shared_ptr<IMemoryState>;
28 * @brief Gets name of current memory state, if length of array is not enough name is truncated by len, null
29 * terminator is inserted as well.
31 * @param name preallocated buffer for receiving name
32 * @param len Length of the buffer
33 * @param resp Optional: pointer to an already allocated object to contain information in case of failure
34 * @return Status code of the operation: InferenceEngine::OK (0) for success
36 virtual StatusCode GetName(char* name, size_t len, ResponseDesc* resp) const noexcept = 0;
39 * @brief reset internal memory state for relevant iexecutable network, to a value specified in SetState
41 * @param resp Optional: pointer to an already allocated object to contain information in case of failure
42 * @return Status code of the operation: InferenceEngine::OK (0) for success*
44 virtual StatusCode Reset(ResponseDesc* resp) noexcept = 0;
47 * @brief Sets the new state that is used for all future Reset() operations as a base.
49 * This method can fail if Blob size does not match the internal state size or precision
51 * @param newState is the data to use as base state
52 * @param resp Optional: pointer to an already allocated object to contain information in case of failure
53 * @return Status code of the operation: InferenceEngine::OK (0) for success
55 virtual StatusCode SetState(Blob::Ptr newState, ResponseDesc* resp) noexcept = 0;
58 * @brief returns the value of the last memory state.
60 * @details Since we roll memory after each infer, we can query the input state always and still get the last state.
62 * @param resp Optional: pointer to an already allocated object to contain information in case of failure
63 * @return Status code of the operation: InferenceEngine::OK (0) for success
65 virtual StatusCode GetLastState(Blob::CPtr& lastState, ResponseDesc* resp) const noexcept = 0;
68 } // namespace InferenceEngine