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