parent
f1009cb21b
commit
7d2fd6e76c
@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Copyright 2021 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MINDSPORE_INCLUDE_API_DATA_TYPE_H_
|
||||
#define MINDSPORE_INCLUDE_API_DATA_TYPE_H_
|
||||
|
||||
namespace mindspore {
|
||||
enum class DataType : int {
|
||||
kTypeUnknown = 0,
|
||||
kObjectTypeString = 12,
|
||||
kObjectTypeList = 13,
|
||||
kObjectTypeTuple = 14,
|
||||
kObjectTypeTensorType = 17,
|
||||
kNumberTypeBool = 30,
|
||||
kNumberTypeInt8 = 32,
|
||||
kNumberTypeInt16 = 33,
|
||||
kNumberTypeInt32 = 34,
|
||||
kNumberTypeInt64 = 35,
|
||||
kNumberTypeUInt8 = 37,
|
||||
kNumberTypeUInt16 = 38,
|
||||
kNumberTypeUInt32 = 39,
|
||||
kNumberTypeUInt64 = 40,
|
||||
kNumberTypeFloat16 = 42,
|
||||
kNumberTypeFloat32 = 43,
|
||||
kNumberTypeFloat64 = 44,
|
||||
kNumberTypeEnd = 46,
|
||||
// add new enum here
|
||||
kInvalidType = INT32_MAX,
|
||||
};
|
||||
} // namespace mindspore
|
||||
#endif // MINDSPORE_INCLUDE_API_DATA_TYPE_H_
|
@ -0,0 +1,77 @@
|
||||
/**
|
||||
* Copyright 2021 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MINDSPORE_INCLUDE_API_LITE_CONTEXT_H
|
||||
#define MINDSPORE_INCLUDE_API_LITE_CONTEXT_H
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <map>
|
||||
#include <any>
|
||||
#include "include/api/types.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace lite {
|
||||
/// \brief CpuBindMode defined for holding bind cpu strategy argument.
|
||||
typedef enum : uint32_t {
|
||||
NO_BIND = 0, /**< no bind */
|
||||
HIGHER_CPU = 1, /**< bind higher cpu first */
|
||||
MID_CPU = 2 /**< bind middle cpu first */
|
||||
} CpuBindMode;
|
||||
|
||||
class Allocator;
|
||||
} // namespace lite
|
||||
|
||||
struct MS_API Context {
|
||||
public:
|
||||
static void Clear(const std::shared_ptr<Context> &contxet);
|
||||
|
||||
static void SetAsDefault(const std::shared_ptr<Context> &contxet);
|
||||
|
||||
static void SetVendorName(const std::shared_ptr<Context> &contxet, const std::string &name);
|
||||
static std::string GetVendorName(const std::shared_ptr<Context> &contxet);
|
||||
|
||||
static void SetThreadNum(const std::shared_ptr<Context> &contxet, int num);
|
||||
static int GetThreadNum(const std::shared_ptr<Context> &contxet);
|
||||
|
||||
static void SetAllocator(const std::shared_ptr<Context> &contxet, std::shared_ptr<lite::Allocator> alloc);
|
||||
static std::shared_ptr<lite::Allocator> GetAllocator(const std::shared_ptr<Context> &contxet);
|
||||
|
||||
static void ConfigCPU(const std::shared_ptr<Context> &contxet, bool config);
|
||||
static bool IfCPUEnabled(const std::shared_ptr<Context> &contxet);
|
||||
|
||||
static void ConfigCPUFp16(const std::shared_ptr<Context> &contxet, bool config);
|
||||
static bool IfCPUFp16Enabled(const std::shared_ptr<Context> &contxet);
|
||||
|
||||
static void SetCPUBindMode(const std::shared_ptr<Context> &contxet, lite::CpuBindMode mode);
|
||||
static lite::CpuBindMode GetCPUBindMode(const std::shared_ptr<Context> &contxet);
|
||||
|
||||
static void ConfigGPU(const std::shared_ptr<Context> &contxet, bool config);
|
||||
static bool IfGPUEnabled(const std::shared_ptr<Context> &contxet);
|
||||
|
||||
static void ConfigGPUFp16(const std::shared_ptr<Context> &contxet, bool config);
|
||||
static bool IfGPUFp16Enabled(const std::shared_ptr<Context> &contxet);
|
||||
|
||||
static void ConfigNPU(const std::shared_ptr<Context> &contxet, bool config);
|
||||
static bool IfNPUEnabled(const std::shared_ptr<Context> &contxet);
|
||||
|
||||
static void SetNPUFrequency(const std::shared_ptr<Context> &contxet, int freq);
|
||||
static int GetNPUFrequency(const std::shared_ptr<Context> &contxet);
|
||||
|
||||
private:
|
||||
std::map<std::string, std::any> context_;
|
||||
};
|
||||
} // namespace mindspore
|
||||
#endif // MINDSPORE_INCLUDE_API_LITE_CONTEXT_H
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue