ie_imemory_state.hpp
Go to the documentation of this file.
1 // Copyright (C) 2018-2020 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 /**
6  * @brief a header file for IMemoryState interface
7  *
8  * @file ie_imemory_state.hpp
9  */
10 
11 #pragma once
12 #include <memory>
13 
14 #include "details/ie_no_copy.hpp"
15 #include "ie_blob.h"
16 #include "ie_common.h"
17 
18 namespace InferenceEngine {
19 
20 /**
21  * @brief manages data for reset operations
22  */
23 class IMemoryState : public details::no_copy {
24 public:
25  using Ptr = std::shared_ptr<IMemoryState>;
26 
27  /**
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.
30  *
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
35  */
36  virtual StatusCode GetName(char* name, size_t len, ResponseDesc* resp) const noexcept = 0;
37 
38  /**
39  * @brief reset internal memory state for relevant iexecutable network, to a value specified in SetState
40  *
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*
43  */
44  virtual StatusCode Reset(ResponseDesc* resp) noexcept = 0;
45 
46  /**
47  * @brief Sets the new state that is used for all future Reset() operations as a base.
48  *
49  * This method can fail if Blob size does not match the internal state size or precision
50  *
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
54  */
55  virtual StatusCode SetState(Blob::Ptr newState, ResponseDesc* resp) noexcept = 0;
56 
57  /**
58  * @brief returns the value of the last memory state.
59  *
60  * @details Since we roll memory after each infer, we can query the input state always and still get the last state.
61  * @param lastState
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
64  * */
65  virtual StatusCode GetLastState(Blob::CPtr& lastState, ResponseDesc* resp) const noexcept = 0;
66 };
67 
68 } // namespace InferenceEngine
Inference Engine API.
Definition: ie_argmax_layer.hpp:15
manages data for reset operations
Definition: ie_imemory_state.hpp:23
virtual StatusCode Reset(ResponseDesc *resp) noexcept=0
reset internal memory state for relevant iexecutable network, to a value specified in SetState ...
A header file for Blob and generic TBlob<>
std::shared_ptr< const Blob > CPtr
A smart pointer to the const Blob object.
Definition: ie_blob.h:47
virtual StatusCode GetName(char *name, size_t len, ResponseDesc *resp) const noexcept=0
Gets name of current memory state, if length of array is not enough name is truncated by len...
Represents detailed information for an error.
Definition: ie_common.h:239
StatusCode
This enum contains codes for all possible return values of the interface functions.
Definition: ie_common.h:216
std::shared_ptr< Blob > Ptr
A smart pointer containing Blob object.
Definition: ie_blob.h:42
virtual StatusCode SetState(Blob::Ptr newState, ResponseDesc *resp) noexcept=0
Sets the new state that is used for all future Reset() operations as a base.
header file for no_copy class
virtual StatusCode GetLastState(Blob::CPtr &lastState, ResponseDesc *resp) const noexcept=0
returns the value of the last memory state.
This is a header file with common inference engine definitions.