Browse Source

fix API C++

tags/v0.7.0-beta
liuxiao78 5 years ago
parent
commit
fce34b0213
5 changed files with 14 additions and 14 deletions
  1. +2
    -2
      mindspore/lite/include/context.h
  2. +3
    -3
      mindspore/lite/include/errorcode.h
  3. +4
    -4
      mindspore/lite/include/lite_session.h
  4. +1
    -1
      mindspore/lite/include/model.h
  5. +4
    -4
      mindspore/lite/include/ms_tensor.h

+ 2
- 2
mindspore/lite/include/context.h View File

@@ -7,7 +7,7 @@
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
@@ -46,7 +46,7 @@ typedef struct {
DeviceType type; /**< device type */ DeviceType type; /**< device type */
} DeviceContext; } DeviceContext;


/// \brief Context defined for holding some environment for runtime.
/// \brief Context defined for holding environment variables during runtime.
class MS_API Context { class MS_API Context {
public: public:
/// \brief Constructor of MindSpore Lite Context using default value for parameters. /// \brief Constructor of MindSpore Lite Context using default value for parameters.


+ 3
- 3
mindspore/lite/include/errorcode.h View File

@@ -19,7 +19,7 @@


namespace mindspore { namespace mindspore {
namespace lite { namespace lite {
/// \brief STATUS defined error code in MindSpore Lite.
/// \brief STATUS defined for holding error code in MindSpore Lite.
using STATUS = int; using STATUS = int;


/* Success */ /* Success */
@@ -31,7 +31,7 @@ constexpr int RET_NULL_PTR = -2; /**< NULL pointer returned.*/
constexpr int RET_PARAM_INVALID = -3; /**< Invalid parameter.*/ constexpr int RET_PARAM_INVALID = -3; /**< Invalid parameter.*/
constexpr int RET_NO_CHANGE = -4; /**< No change. */ constexpr int RET_NO_CHANGE = -4; /**< No change. */
constexpr int RET_SUCCESS_EXIT = -5; /**< No error but exit. */ constexpr int RET_SUCCESS_EXIT = -5; /**< No error but exit. */
constexpr int RET_MEMORY_FAILED = -6; /**< Create memory failed. */
constexpr int RET_MEMORY_FAILED = -6; /**< Fail to create memory. */


/* Executor error code, range: [-101,-200] */ /* Executor error code, range: [-101,-200] */
constexpr int RET_OUT_OF_TENSOR_RANGE = -101; /**< Failed to check range. */ constexpr int RET_OUT_OF_TENSOR_RANGE = -101; /**< Failed to check range. */
@@ -52,7 +52,7 @@ constexpr int RET_FORMAT_ERR = -401; /**< Failed to checking tensor format. */


/* InferShape error code, range: [-501,-600] */ /* InferShape error code, range: [-501,-600] */
constexpr int RET_INFER_ERR = -501; /**< Failed to infer shape. */ constexpr int RET_INFER_ERR = -501; /**< Failed to infer shape. */
constexpr int RET_INFER_INVALID = -502; /**< Invalid to infer shape before runtime. */
constexpr int RET_INFER_INVALID = -502; /**< Invalid infer shape before runtime. */
} // namespace lite } // namespace lite
} // namespace mindspore } // namespace mindspore




+ 4
- 4
mindspore/lite/include/lite_session.h View File

@@ -50,14 +50,14 @@ class MS_API LiteSession {
/// \brief Destructor of MindSpore Lite LiteSession. /// \brief Destructor of MindSpore Lite LiteSession.
virtual ~LiteSession() = default; virtual ~LiteSession() = default;


/// \brief Try to bind or unbind threads in the thread pool to the specified cpu core.
/// \brief Attempt to bind or unbind threads in the thread pool to or from the specified cpu core.
/// ///
/// \param[in] if_bind Define whether to bind or unbind threads. /// \param[in] if_bind Define whether to bind or unbind threads.
virtual void BindThread(bool if_bind) = 0; virtual void BindThread(bool if_bind) = 0;


/// \brief Compile MindSpore Lite model. /// \brief Compile MindSpore Lite model.
/// ///
/// \note CompileGraph should called before RunGraph.
/// \note CompileGraph should be called before RunGraph.
/// ///
/// \param[in] model Define the model to be compiled. /// \param[in] model Define the model to be compiled.
/// ///
@@ -78,10 +78,10 @@ class MS_API LiteSession {


/// \brief Run session with callback. /// \brief Run session with callback.
/// ///
/// \param[in] before Define a call_back_function called before running each node.
/// \param[in] before Define a call_back_function to be called before running each node.
/// \param[in] after Define a call_back_function called after running each node. /// \param[in] after Define a call_back_function called after running each node.
/// ///
/// \note RunGraph should called after CompileGraph.
/// \note RunGraph should be called after CompileGraph.
/// ///
/// \return STATUS as an error code of running graph, STATUS is defined in errorcode.h. /// \return STATUS as an error code of running graph, STATUS is defined in errorcode.h.
virtual int RunGraph(const KernelCallBack &before = nullptr, const KernelCallBack &after = nullptr) = 0; virtual int RunGraph(const KernelCallBack &before = nullptr, const KernelCallBack &after = nullptr) = 0;


+ 1
- 1
mindspore/lite/include/model.h View File

@@ -101,7 +101,7 @@ class MS_API ModelBuilder {
/// \param[in] op Define the primitive to be added. /// \param[in] op Define the primitive to be added.
/// \param[in] inputs Define input edge of primitive to be added. /// \param[in] inputs Define input edge of primitive to be added.
/// ///
/// \return ID of the primitive added.
/// \return ID of the added primitive.
virtual std::string AddOp(const lite::Primitive &op, const std::vector<OutEdge> &inputs) = 0; virtual std::string AddOp(const lite::Primitive &op, const std::vector<OutEdge> &inputs) = 0;


/// \brief Finish constructing the model. /// \brief Finish constructing the model.


+ 4
- 4
mindspore/lite/include/ms_tensor.h View File

@@ -38,7 +38,7 @@ class MS_API MSTensor {
/// \param[in] data_type Define data type of tensor to be created. /// \param[in] data_type Define data type of tensor to be created.
/// \param[in] shape Define Shape of tensor to be created. /// \param[in] shape Define Shape of tensor to be created.
/// ///
/// \note TypeId is defined in mindspore/mindspore/core/ir/dtype/type_id.h. Only number types in TypeId enum is
/// \note TypeId is defined in mindspore/mindspore/core/ir/dtype/type_id.h. Only number types in TypeId enum are
/// suitable for MSTensor. /// suitable for MSTensor.
/// ///
/// \return the pointer of MSTensor. /// \return the pointer of MSTensor.
@@ -49,7 +49,7 @@ class MS_API MSTensor {


/// \brief Get data type of the MindSpore Lite MSTensor. /// \brief Get data type of the MindSpore Lite MSTensor.
/// ///
/// \note TypeId is defined in mindspore/mindspore/core/ir/dtype/type_id.h. Only number types in TypeId enum is
/// \note TypeId is defined in mindspore/mindspore/core/ir/dtype/type_id.h. Only number types in TypeId enum are
/// suitable for MSTensor. /// suitable for MSTensor.
/// ///
/// \return MindSpore Lite TypeId of the MindSpore Lite MSTensor. /// \return MindSpore Lite TypeId of the MindSpore Lite MSTensor.
@@ -57,7 +57,7 @@ class MS_API MSTensor {


/// \brief Set data type for the MindSpore Lite MSTensor. /// \brief Set data type for the MindSpore Lite MSTensor.
/// ///
/// \param[in] data_type Define MindSpore Lite TypeId to be set into the MindSpore Lite MSTensor.
/// \param[in] data_type Define MindSpore Lite TypeId to be set in the MindSpore Lite MSTensor.
/// ///
/// \return MindSpore Lite TypeId of the MindSpore Lite MSTensor after set. /// \return MindSpore Lite TypeId of the MindSpore Lite MSTensor after set.
virtual TypeId set_data_type(TypeId data_type) = 0; virtual TypeId set_data_type(TypeId data_type) = 0;
@@ -98,7 +98,7 @@ class MS_API MSTensor {


/// \brief Get the pointer of data in MSTensor. /// \brief Get the pointer of data in MSTensor.
/// ///
/// \note The data pointer can be used to both write or read data in MSTensor.
/// \note The data pointer can be used to both write and read data in MSTensor.
/// ///
/// \return the pointer points to data in MSTensor. /// \return the pointer points to data in MSTensor.
virtual void *MutableData() const = 0; virtual void *MutableData() const = 0;


Loading…
Cancel
Save