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  * @interface IMemoryState
22  * @brief manages data for reset operations
23  */
24 class IMemoryState : public details::no_copy {
25 public:
26  /**
27  * @brief A shared pointer to the IMemoryState interface
28  */
29  using Ptr = std::shared_ptr<IMemoryState>;
30 
31  /**
32  * @brief Gets name of current memory state, if length of array is not enough name is truncated by len, null
33  * terminator is inserted as well.
34  *
35  * @param name preallocated buffer for receiving name
36  * @param len Length of the buffer
37  * @param resp Optional: pointer to an already allocated object to contain information in case of failure
38  * @return Status code of the operation: InferenceEngine::OK (0) for success
39  */
40  virtual StatusCode GetName(char* name, size_t len, ResponseDesc* resp) const noexcept = 0;
41 
42  /**
43  * @brief reset internal memory state for relevant iexecutable network, to a value specified in SetState
44  *
45  * @param resp Optional: pointer to an already allocated object to contain information in case of failure
46  * @return Status code of the operation: InferenceEngine::OK (0) for success*
47  */
48  virtual StatusCode Reset(ResponseDesc* resp) noexcept = 0;
49 
50  /**
51  * @brief Sets the new state that is used for all future Reset() operations as a base.
52  *
53  * This method can fail if Blob size does not match the internal state size or precision
54  *
55  * @param newState is the data to use as base state
56  * @param resp Optional: pointer to an already allocated object to contain information in case of failure
57  * @return Status code of the operation: InferenceEngine::OK (0) for success
58  */
59  virtual StatusCode SetState(Blob::Ptr newState, ResponseDesc* resp) noexcept = 0;
60 
61  /**
62  * @brief returns the value of the last memory state.
63  *
64  * @details Since we roll memory after each infer, we can query the input state always and still get the last state.
65  * @param lastState
66  * @param resp Optional: pointer to an already allocated object to contain information in case of failure
67  * @return Status code of the operation: InferenceEngine::OK (0) for success
68  * */
69  virtual StatusCode GetLastState(Blob::CPtr& lastState, ResponseDesc* resp) const noexcept = 0;
70 };
71 
72 } // namespace InferenceEngine
Inference Engine API.
Definition: ie_argmax_layer.hpp:15
manages data for reset operations
Definition: ie_imemory_state.hpp:24
std::string name
Layer name.
Definition: ie_layers.h:42
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< IMemoryState > Ptr
A shared pointer to the IMemoryState interface.
Definition: ie_imemory_state.hpp:29
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:247
StatusCode
This enum contains codes for all possible return values of the interface functions.
Definition: ie_common.h:224
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.