@@ -112,6 +112,7 @@ const char *const ORIGINAL_MODEL_FILE = "ge.originalModelFile"; | |||
const char *const INPUT_FP16_NODES = "ge.INPUT_NODES_SET_FP16"; | |||
const char *const OP_DEBUG_LEVEL = "ge.opDebugLevel"; | |||
const char *const PERFORMANCE_MODE = "ge.performance_mode"; | |||
const char *const SHAPE_GENERALIZED_BUILD_MODE = "ge.shape_generalized_build_mode"; | |||
const char *const MODIFY_MIXLIST = "ge.exec.modify_mixlist"; | |||
const char *const OP_PRECISION_MODE = "ge.exec.op_precision_mode"; | |||
} // namespace configure_option | |||
@@ -325,6 +326,11 @@ const char *const INPUT_SHAPE_RANGE = "input_shape_range"; | |||
// high: need to recompile, high execute performance mode | |||
const std::string PERFORMANCE_MODE = "ge.performance_mode"; | |||
// For selecting the mode of shape generalization when build graph. | |||
// shape_generalized: Shape will be generalized during graph build. | |||
// shape_precise: Shape will not be generalized, use precise shape. | |||
const std::string SHAPE_GENERALIZED_BUILD_MODE = "ge.shape_generalized_build_mode"; | |||
const std::string MODIFY_MIXLIST = "ge.exec.modify_mixlist"; | |||
const std::string OP_PRECISION_MODE = "ge.exec.op_precision_mode"; | |||
@@ -407,6 +413,7 @@ static const char *const OP_BANK_PATH = ge::OP_BANK_PATH_FLAG.c_str(); | |||
static const char *const OP_BANK_UPDATE = ge::OP_BANK_UPDATE_FLAG.c_str(); | |||
static const char *const OP_DEBUG_LEVEL = ge::OP_DEBUG_LEVEL.c_str(); | |||
static const char *const PERFORMANCE_MODE = ge::PERFORMANCE_MODE.c_str(); | |||
static const char *const SHAPE_GENERALIZED_BUILD_MODE = ge::SHAPE_GENERALIZED_BUILD_MODE.c_str(); | |||
static const char *const MODIFY_MIXLIST = ge::MODIFY_MIXLIST.c_str(); | |||
static const char *const OP_PRECISION_MODE = ge::OP_PRECISION_MODE.c_str(); | |||
@@ -437,12 +444,13 @@ const std::set<std::string> ir_builder_suppported_options = {INPUT_FORMAT, | |||
OP_BANK_PATH, | |||
OP_BANK_UPDATE, | |||
PERFORMANCE_MODE, | |||
SHAPE_GENERALIZED_BUILD_MODE, | |||
MODIFY_MIXLIST}; | |||
// for interface: aclgrphParse | |||
const std::set<std::string> ir_parser_suppported_options = { | |||
INPUT_FP16_NODES, IS_INPUT_ADJUST_HW_LAYOUT, IS_OUTPUT_ADJUST_HW_LAYOUT, OUTPUT, | |||
OUT_NODES, ENABLE_SCOPE_FUSION_PASSES}; | |||
INPUT_FP16_NODES, IS_INPUT_ADJUST_HW_LAYOUT, IS_OUTPUT_ADJUST_HW_LAYOUT, OUTPUT, | |||
OUT_NODES, ENABLE_SCOPE_FUSION_PASSES}; | |||
// for interface: aclgrphBuildInitialize | |||
const std::set<std::string> global_options = {CORE_TYPE, | |||
@@ -97,6 +97,10 @@ static const int32_t ACL_ERROR_RT_VECTOR_CORE_TIMEOUT = 507034; // vecto | |||
static const int32_t ACL_ERROR_RT_VECTOR_CORE_EXCEPTION = 507035; // vector core exception | |||
static const int32_t ACL_ERROR_RT_VECTOR_CORE_TRAP_EXCEPTION = 507036; // vector core trap exception | |||
static const int32_t ACL_ERROR_RT_CDQ_BATCH_ABNORMAL = 507037; // cdq alloc batch abnormal | |||
static const int32_t ACL_ERROR_RT_DIE_MODE_CHANGE_ERROR = 507038; // can not change die mode | |||
static const int32_t ACL_ERROR_RT_DIE_SET_ERROR = 507039; // single die mode can not set die | |||
static const int32_t ACL_ERROR_RT_INVALID_DIEID = 507040; // invalid die id | |||
static const int32_t ACL_ERROR_RT_DIE_MODE_NOT_SET = 507041; // die mode not set | |||
static const int32_t ACL_ERROR_RT_DRV_INTERNAL_ERROR = 507899; // drv internal error | |||
static const int32_t ACL_ERROR_RT_AICPU_INTERNAL_ERROR = 507900; // aicpu internal error | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -41,7 +41,7 @@ enum FrameworkType { | |||
}; | |||
const std::map<std::string, std::string> kFwkTypeToStr = { | |||
{"0", "Caffe"}, {"1", "MindSpore"}, {"3", "TensorFlow"}, {"4", "Android_NN"}, {"5", "Onnx"}}; | |||
{"0", "Caffe"}, {"1", "MindSpore"}, {"3", "TensorFlow"}, {"4", "Android_NN"}, {"5", "Onnx"}}; | |||
enum OpEngineType { | |||
ENGINE_SYS = 0, // default engine | |||
@@ -230,6 +230,14 @@ class GE_FUNC_VISIBILITY ModelListener { | |||
/// | |||
virtual Status OnComputeDone(uint32_t model_id, uint32_t data_index, uint32_t result_code, | |||
std::vector<ge::Tensor> &outputs) = 0; | |||
virtual uint32_t GetResultCode() { | |||
return 0; | |||
}; | |||
virtual Status ResetResult() { | |||
return SUCCESS; | |||
}; | |||
}; | |||
// OMM configuration item | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -18,32 +18,8 @@ | |||
#define INC_FRAMEWORK_COMMON_GE_PROFILING_H_ | |||
#include "ge/ge_api_error_codes.h" | |||
#include "toolchain/prof_callback.h" | |||
#include "runtime/base.h" | |||
const int MAX_DEV_NUM = 64; | |||
enum ProfCommandHandleType { | |||
kProfCommandhandleInit = 0, | |||
kProfCommandhandleStart, | |||
kProfCommandhandleStop, | |||
kProfCommandhandleFinalize, | |||
kProfCommandhandleModelSubscribe, | |||
kProfCommandhandleModelUnsubscribe | |||
}; | |||
struct ProfCommandHandleData { | |||
uint64_t profSwitch; | |||
uint32_t devNums; // length of device id list | |||
uint32_t devIdList[MAX_DEV_NUM]; | |||
uint32_t modelId; | |||
}; | |||
GE_FUNC_VISIBILITY ge::Status RegProfCtrlCallback(MsprofCtrlCallback func); | |||
GE_FUNC_VISIBILITY ge::Status RegProfSetDeviceCallback(MsprofSetDeviceCallback func); | |||
GE_FUNC_VISIBILITY ge::Status RegProfReporterCallback(MsprofReporterCallback func); | |||
GE_FUNC_VISIBILITY ge::Status ProfCommandHandle(ProfCommandHandleType type, void *data, uint32_t len); | |||
/// | |||
/// @brief Output the profiling data of single operator in Pytorch, and does not support multithreading | |||
/// @return Status result | |||
@@ -52,4 +28,6 @@ GE_FUNC_VISIBILITY ge::Status ProfSetStepInfo(uint64_t index_id, uint16_t tag_id | |||
GE_FUNC_VISIBILITY ge::Status ProfGetDeviceFormGraphId(uint32_t graph_id, uint32_t &device_id); | |||
GE_FUNC_VISIBILITY void ProfSetGraphIdToDeviceMap(uint32_t graph_id, uint32_t &device_id); | |||
#endif // INC_FRAMEWORK_COMMON_GE_PROFILING_H_ |
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -1,113 +0,0 @@ | |||
/** | |||
* Copyright 2019-2020 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 INC_FRAMEWORK_GE_RUNTIME_DAVINCI_MODEL_H_ | |||
#define INC_FRAMEWORK_GE_RUNTIME_DAVINCI_MODEL_H_ | |||
#include <memory> | |||
#include <vector> | |||
#include "ge_runtime/op_info.h" | |||
#include "ge_runtime/task_info.h" | |||
namespace ge { | |||
namespace model_runner { | |||
class DavinciModel { | |||
public: | |||
DavinciModel(const std::vector<std::shared_ptr<TaskInfo>> &task_info_list, | |||
const std::vector<std::shared_ptr<OpInfo>> &data_info_list, | |||
const std::vector<std::shared_ptr<OpInfo>> &output_info_list, | |||
const std::vector<std::shared_ptr<OpInfo>> &constant_info_list, | |||
const std::vector<model_runner::OpInfoPtr> &variable_info_list, | |||
const std::vector<uint32_t> &wait_active_stream_list, | |||
const std::vector<uint32_t> &force_copy_stream_list, uint64_t mem_size = 0, uint64_t weight_size = 0, | |||
uint64_t var_size = 0, uintptr_t logic_mem_base = 0, uintptr_t logic_weight_base = 0, | |||
uintptr_t logic_var_base = 0, uint32_t stream_num = 0, uint32_t batch_num = 0, uint32_t event_num = 0, | |||
int32_t priority = 0) | |||
: task_info_list_(task_info_list), | |||
data_info_list_(data_info_list), | |||
output_info_list_(output_info_list), | |||
constant_info_list_(constant_info_list), | |||
variable_info_list_(variable_info_list), | |||
wait_active_stream_list_(wait_active_stream_list), | |||
force_copy_stream_list_(force_copy_stream_list), | |||
mem_size_(mem_size), | |||
weight_size_(weight_size), | |||
var_size_(var_size), | |||
logic_mem_base_(logic_mem_base), | |||
logic_weight_base_(logic_weight_base), | |||
logic_var_base_(logic_var_base), | |||
stream_num_(stream_num), | |||
batch_num_(batch_num), | |||
event_num_(event_num), | |||
priority_(priority) {} | |||
~DavinciModel() {} | |||
uint64_t GetMemSize() const { return mem_size_; } | |||
uint64_t GetWeightSize() const { return weight_size_; } | |||
uint64_t GetVarSize() const { return var_size_; } | |||
uintptr_t GetLogicMemBase() const { return logic_mem_base_; } | |||
uintptr_t GetLogicWeightBase() const { return logic_weight_base_; } | |||
uintptr_t GetLogicVarBase() const { return logic_var_base_; } | |||
uint32_t GetStreamNum() const { return stream_num_; } | |||
uint32_t GetBatchNum() const { return batch_num_; } | |||
uint32_t GetEventNum() const { return event_num_; } | |||
const std::vector<uint32_t> &GetWaitActiveStreams() const { return wait_active_stream_list_; } | |||
const std::vector<uint32_t> &GetForceCopyStreams() const { return force_copy_stream_list_; } | |||
int32_t GetPriority() const { return priority_; } | |||
const std::vector<std::shared_ptr<TaskInfo>> &GetTaskInfoList() const { return task_info_list_; } | |||
const std::vector<std::shared_ptr<OpInfo>> &GetDataInfoList() const { return data_info_list_; } | |||
const std::vector<std::shared_ptr<OpInfo>> &GetOutputInfoList() const { return output_info_list_; } | |||
const std::vector<std::shared_ptr<OpInfo>> &GetConstantInfoList() const { return output_info_list_; } | |||
const std::vector<model_runner::OpInfoPtr> &GetVariableInfoList() const { return variable_info_list_; } | |||
private: | |||
std::vector<std::shared_ptr<TaskInfo>> task_info_list_; | |||
std::vector<std::shared_ptr<OpInfo>> data_info_list_; | |||
std::vector<std::shared_ptr<OpInfo>> output_info_list_; | |||
std::vector<std::shared_ptr<OpInfo>> constant_info_list_; | |||
std::vector<model_runner::OpInfoPtr> variable_info_list_; | |||
std::vector<uint32_t> wait_active_stream_list_; | |||
std::vector<uint32_t> force_copy_stream_list_; | |||
uint64_t mem_size_; | |||
uint64_t weight_size_; | |||
uint64_t var_size_; | |||
uintptr_t logic_mem_base_; | |||
uintptr_t logic_weight_base_; | |||
uintptr_t logic_var_base_; | |||
uint32_t stream_num_; | |||
uint32_t batch_num_; | |||
uint32_t event_num_; | |||
int32_t priority_; | |||
// Disable to copy constructor and assignment operator | |||
DavinciModel &operator=(const DavinciModel &) = delete; | |||
DavinciModel(const DavinciModel &) = delete; | |||
}; | |||
} // namespace model_runner | |||
} // namespace ge | |||
#endif // INC_FRAMEWORK_GE_RUNTIME_DAVINCI_MODEL_H_ |
@@ -1,68 +0,0 @@ | |||
/** | |||
* Copyright 2019-2020 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 INC_FRAMEWORK_GE_RUNTIME_MODEL_RUNNER_H_ | |||
#define INC_FRAMEWORK_GE_RUNTIME_MODEL_RUNNER_H_ | |||
#include <memory> | |||
#include <unordered_map> | |||
#include <vector> | |||
#include "common/ge_inner_error_codes.h" | |||
#include "common/ge_types.h" | |||
#include "ge_runtime/davinci_model.h" | |||
namespace ge { | |||
namespace model_runner { | |||
class RuntimeModel; | |||
using RuntimeInfo = std::tuple<uint32_t, uint32_t, void *>; | |||
class ModelRunner { | |||
public: | |||
static ModelRunner &Instance(); | |||
bool LoadDavinciModel(uint32_t device_id, uint64_t session_id, uint32_t model_id, | |||
std::shared_ptr<DavinciModel> davinci_model, std::shared_ptr<ModelListener> listener); | |||
bool DistributeTask(uint32_t model_id); | |||
bool LoadModelComplete(uint32_t model_id); | |||
const std::vector<uint32_t> &GetTaskIdList(uint32_t model_id) const; | |||
const std::vector<uint32_t> &GetStreamIdList(uint32_t model_id) const; | |||
const std::map<std::string, std::shared_ptr<RuntimeInfo>> &GetRuntimeInfoMap(uint32_t model_id) const; | |||
void *GetModelHandle(uint32_t model_id) const; | |||
bool UnloadModel(uint32_t model_id); | |||
bool RunModel(uint32_t model_id, const InputData &input_data, OutputData *output_data); | |||
bool GetInputOutputDescInfo(uint32_t model_id, bool zero_copy, std::vector<InputOutputDescInfo> *input_desc, | |||
std::vector<InputOutputDescInfo> *output_desc, std::vector<uint32_t> *input_format, | |||
std::vector<uint32_t> *output_format); | |||
private: | |||
ModelRunner() = default; | |||
~ModelRunner() = default; | |||
std::unordered_map<uint32_t, std::shared_ptr<RuntimeModel>> runtime_models_; | |||
}; | |||
} // namespace model_runner | |||
} // namespace ge | |||
#endif // INC_FRAMEWORK_GE_RUNTIME_MODEL_RUNNER_H_ |
@@ -1,72 +0,0 @@ | |||
/** | |||
* Copyright 2019-2020 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 INC_FRAMEWORK_GE_RUNTIME_OP_INFO_H_ | |||
#define INC_FRAMEWORK_GE_RUNTIME_OP_INFO_H_ | |||
#include <memory> | |||
#include <string> | |||
#include <vector> | |||
namespace ge { | |||
namespace model_runner { | |||
struct TensorInfo { | |||
int64_t GetShapeSize() const { | |||
int64_t res = 1; | |||
if (dims.empty()) { | |||
return 0; | |||
} | |||
for (auto dim : dims) { | |||
res *= dim; | |||
} | |||
return res; | |||
} | |||
int64_t GetDim(uint32_t index) { | |||
if (index >= dims.size()) { | |||
return 0; | |||
} | |||
return dims[index]; | |||
} | |||
std::vector<int64_t> dims; | |||
uint32_t datatype; | |||
uint32_t format; | |||
uint32_t real_dim_cnt; | |||
uint32_t size; | |||
bool is_output; | |||
}; | |||
struct OpInfo { | |||
uint32_t index; | |||
std::string name; | |||
std::string type; | |||
bool var_is_broadcast; | |||
std::vector<uintptr_t> input_addrs; | |||
std::vector<uintptr_t> output_addrs; | |||
std::vector<TensorInfo> input_tensors; | |||
std::vector<TensorInfo> output_tensors; | |||
std::vector<TensorInfo> weight_tensors; | |||
std::vector<std::string> src_name; | |||
std::vector<int64_t> src_index; | |||
std::string weight_data; | |||
}; | |||
using TensorInfoPtr = std::shared_ptr<TensorInfo>; | |||
using OpInfoPtr = std::shared_ptr<OpInfo>; | |||
} // namespace model_runner | |||
} // namespace ge | |||
#endif // INC_FRAMEWORK_GE_RUNTIME_OP_INFO_H_ |
@@ -1,529 +0,0 @@ | |||
/** | |||
* Copyright 2019-2020 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 INC_FRAMEWORK_GE_RUNTIME_TASK_INFO_H_ | |||
#define INC_FRAMEWORK_GE_RUNTIME_TASK_INFO_H_ | |||
#include <stdint.h> | |||
#include <memory> | |||
#include <string> | |||
#include <utility> | |||
#include <vector> | |||
#include "cce/taskdown_api.h" | |||
namespace ge { | |||
namespace model_runner { | |||
enum TaskInfoType { | |||
CCE = 0, | |||
TBE, | |||
AICPU, | |||
LABEL_SET, | |||
LABEL_SWITCH, | |||
LABEL_GOTO, | |||
EVENT_RECORD, | |||
EVENT_WAIT, | |||
FUSION_START, | |||
FUSION_END, | |||
HCCL, | |||
PROFILER_TRACE, | |||
MEMCPY_ASYNC, | |||
STREAM_SWITCH, | |||
STREAM_ACTIVE, | |||
// Insert new task type here | |||
REVSERVED = 23 | |||
}; | |||
class TaskInfo { | |||
public: | |||
virtual ~TaskInfo() {} | |||
uint32_t stream_id() const { | |||
return stream_id_; | |||
} | |||
TaskInfoType type() const { | |||
return type_; | |||
} | |||
std::string op_name() const { | |||
return op_name_; | |||
} | |||
bool dump_flag() const { | |||
return dump_flag_; | |||
} | |||
protected: | |||
TaskInfo(const std::string &op_name, uint32_t stream_id, TaskInfoType type, bool dump_flag) | |||
: op_name_(op_name), stream_id_(stream_id), type_(type), dump_flag_(dump_flag) {} | |||
private: | |||
std::string op_name_; | |||
uint32_t stream_id_; | |||
TaskInfoType type_; | |||
bool dump_flag_; | |||
}; | |||
class CceTaskInfo : public TaskInfo { | |||
public: | |||
CceTaskInfo(const std::string &op_name, uint32_t stream_id, const cce::ccOpContext &ctx, const std::string &stub_func, | |||
uint32_t block_dim, const std::vector<uint8_t> &args, uint32_t args_size, | |||
const std::vector<uint8_t> &sm_desc, const std::vector<uint8_t> &flow_table, | |||
const std::vector<uint8_t> &args_offset, bool is_flowtable) | |||
: TaskInfo(op_name, stream_id, TaskInfoType::CCE, false), | |||
ctx_(ctx), | |||
stub_func_(stub_func), | |||
block_dim_(block_dim), | |||
args_(args), | |||
args_size_(args_size), | |||
sm_desc_(sm_desc), | |||
flow_table_(flow_table), | |||
args_offset_(args_offset), | |||
is_flowtable_(is_flowtable) {} | |||
~CceTaskInfo() override {} | |||
cce::ccOpContext cc_context() const { | |||
return ctx_; | |||
} | |||
std::string stub_func() const { | |||
return stub_func_; | |||
} | |||
uint32_t block_dim() const { | |||
return block_dim_; | |||
} | |||
const std::vector<uint8_t> &args() const { | |||
return args_; | |||
} | |||
uint32_t args_size() const { | |||
return args_size_; | |||
} | |||
const std::vector<uint8_t> &sm_desc() const { | |||
return sm_desc_; | |||
} | |||
const std::vector<uint8_t> &flow_table() const { | |||
return flow_table_; | |||
} | |||
const std::vector<uint8_t> &args_offset() const { | |||
return args_offset_; | |||
} | |||
bool is_flowtable() const { | |||
return is_flowtable_; | |||
} | |||
private: | |||
cce::ccOpContext ctx_; | |||
std::string stub_func_; | |||
uint32_t block_dim_; | |||
std::vector<uint8_t> args_; | |||
uint32_t args_size_; | |||
std::vector<uint8_t> sm_desc_; | |||
std::vector<uint8_t> flow_table_; | |||
std::vector<uint8_t> args_offset_; | |||
bool is_flowtable_; | |||
}; | |||
class TbeTaskInfo : public TaskInfo { | |||
public: | |||
TbeTaskInfo(const std::string &op_name, uint32_t stream_id, const std::string &stub_func, uint32_t block_dim, | |||
const std::vector<uint8_t> &args, uint32_t args_size, const std::vector<uint8_t> &sm_desc, void *binary, | |||
uint32_t binary_size, const std::vector<uint8_t> &meta_data, const std::vector<void *> &input_data_addrs, | |||
const std::vector<void *> &output_data_addrs, const std::vector<void *> &workspace_addrs, bool dump_flag) | |||
: TaskInfo(op_name, stream_id, TaskInfoType::TBE, dump_flag), | |||
stub_func_(stub_func), | |||
block_dim_(block_dim), | |||
args_(args), | |||
args_size_(args_size), | |||
sm_desc_(sm_desc), | |||
binary_(binary), | |||
binary_size_(binary_size), | |||
meta_data_(meta_data), | |||
input_data_addrs_(input_data_addrs), | |||
output_data_addrs_(output_data_addrs), | |||
workspace_addrs_(workspace_addrs) {} | |||
~TbeTaskInfo() override {} | |||
const std::string &stub_func() const { | |||
return stub_func_; | |||
} | |||
uint32_t block_dim() const { | |||
return block_dim_; | |||
} | |||
const std::vector<uint8_t> &args() const { | |||
return args_; | |||
} | |||
uint32_t args_size() const { | |||
return args_size_; | |||
} | |||
const std::vector<uint8_t> &sm_desc() const { | |||
return sm_desc_; | |||
} | |||
void *binary() const { | |||
return binary_; | |||
} | |||
uint32_t binary_size() const { | |||
return binary_size_; | |||
} | |||
const std::vector<uint8_t> &meta_data() const { | |||
return meta_data_; | |||
} | |||
const std::vector<void *> &input_data_addrs() const { | |||
return input_data_addrs_; | |||
} | |||
const std::vector<void *> &output_data_addrs() const { | |||
return output_data_addrs_; | |||
} | |||
const std::vector<void *> &workspace_addrs() const { | |||
return workspace_addrs_; | |||
} | |||
void SetBinary(void *binary, uint32_t binary_size) { | |||
binary_ = binary; | |||
binary_size_ = binary_size; | |||
} | |||
private: | |||
std::string stub_func_; | |||
uint32_t block_dim_; | |||
std::vector<uint8_t> args_; | |||
uint32_t args_size_; | |||
std::vector<uint8_t> sm_desc_; | |||
void *binary_; | |||
uint32_t binary_size_; | |||
std::vector<uint8_t> meta_data_; | |||
std::vector<void *> input_data_addrs_; | |||
std::vector<void *> output_data_addrs_; | |||
std::vector<void *> workspace_addrs_; | |||
}; | |||
class AicpuTaskInfo : public TaskInfo { | |||
public: | |||
AicpuTaskInfo(const std::string &op_name, uint32_t stream_id, const string &so_name, const std::string &kernel_name, | |||
const std::string &node_def, const std::string &ext_info, const std::vector<void *> &input_data_addrs, | |||
const std::vector<void *> &output_data_addrs, bool dump_flag) | |||
: TaskInfo(op_name, stream_id, TaskInfoType::AICPU, dump_flag), | |||
so_name_(so_name), | |||
kernel_name_(kernel_name), | |||
node_def_(node_def), | |||
ext_info_(ext_info), | |||
input_data_addrs_(input_data_addrs), | |||
output_data_addrs_(output_data_addrs) {} | |||
~AicpuTaskInfo() override {} | |||
const std::string &so_name() const { | |||
return so_name_; | |||
} | |||
const std::string &kernel_name() const { | |||
return kernel_name_; | |||
} | |||
const std::string &node_def() const { | |||
return node_def_; | |||
} | |||
const std::vector<void *> &input_data_addrs() const { | |||
return input_data_addrs_; | |||
} | |||
const std::vector<void *> &output_data_addrs() const { | |||
return output_data_addrs_; | |||
} | |||
const std::string &ext_info() const { | |||
return ext_info_; | |||
} | |||
private: | |||
std::string so_name_; | |||
std::string kernel_name_; | |||
std::string node_def_; | |||
std::string ext_info_; | |||
std::vector<void *> input_data_addrs_; | |||
std::vector<void *> output_data_addrs_; | |||
}; | |||
class LabelSetTaskInfo : public TaskInfo { | |||
public: | |||
LabelSetTaskInfo(const std::string &op_name, uint32_t stream_id, uint32_t label_id) | |||
: TaskInfo(op_name, stream_id, TaskInfoType::LABEL_SET, false), label_id_(label_id) {} | |||
~LabelSetTaskInfo() override {} | |||
uint32_t label_id() const { | |||
return label_id_; | |||
} | |||
private: | |||
uint32_t label_id_; | |||
}; | |||
class LabelGotoTaskInfo : public TaskInfo { | |||
public: | |||
LabelGotoTaskInfo(const std::string &op_name, uint32_t stream_id, uint32_t label_id) | |||
: TaskInfo(op_name, stream_id, TaskInfoType::LABEL_GOTO, false), label_id_(label_id) {} | |||
~LabelGotoTaskInfo() override {} | |||
uint32_t label_id() const { | |||
return label_id_; | |||
} | |||
private: | |||
uint32_t label_id_; | |||
}; | |||
class LabelSwitchTaskInfo : public TaskInfo { | |||
public: | |||
LabelSwitchTaskInfo(const std::string &op_name, uint32_t stream_id, uint32_t label_size, | |||
const std::vector<uint32_t> &label_list, void *cond) | |||
: TaskInfo(op_name, stream_id, TaskInfoType::LABEL_SWITCH, false), | |||
label_size_(label_size), | |||
label_list_(label_list), | |||
cond_(cond) {} | |||
~LabelSwitchTaskInfo() override {} | |||
uint32_t label_size() const { | |||
return label_size_; | |||
} | |||
const std::vector<uint32_t> &label_list() const { | |||
return label_list_; | |||
} | |||
void *cond() const { | |||
return cond_; | |||
} | |||
private: | |||
uint32_t label_size_; | |||
std::vector<uint32_t> label_list_; | |||
void *cond_; | |||
}; | |||
class EventTaskInfo : public TaskInfo { | |||
public: | |||
uint32_t event_id() const { | |||
return event_id_; | |||
} | |||
protected: | |||
EventTaskInfo(const std::string &op_name, uint32_t stream_id, TaskInfoType type, uint32_t event_id) | |||
: TaskInfo(op_name, stream_id, type, false), event_id_(event_id) {} | |||
~EventTaskInfo() override {} | |||
uint32_t event_id_; | |||
}; | |||
class EventRecordTaskInfo : public EventTaskInfo { | |||
public: | |||
EventRecordTaskInfo(const std::string &op_name, uint32_t stream_id, uint32_t event_id) | |||
: EventTaskInfo(op_name, stream_id, TaskInfoType::EVENT_RECORD, event_id) {} | |||
~EventRecordTaskInfo() override {} | |||
}; | |||
class EventWaitTaskInfo : public EventTaskInfo { | |||
public: | |||
EventWaitTaskInfo(const std::string &op_name, uint32_t stream_id, uint32_t event_id) | |||
: EventTaskInfo(op_name, stream_id, TaskInfoType::EVENT_WAIT, event_id) {} | |||
~EventWaitTaskInfo() override {} | |||
}; | |||
class FusionStartTaskInfo : public TaskInfo { | |||
public: | |||
explicit FusionStartTaskInfo(const std::string &op_name, uint32_t stream_id) | |||
: TaskInfo(op_name, stream_id, TaskInfoType::FUSION_START, false) {} | |||
~FusionStartTaskInfo() override {} | |||
}; | |||
class FusionEndTaskInfo : public TaskInfo { | |||
public: | |||
explicit FusionEndTaskInfo(const std::string &op_name, uint32_t stream_id) | |||
: TaskInfo(op_name, stream_id, TaskInfoType::FUSION_END, false) {} | |||
~FusionEndTaskInfo() override {} | |||
}; | |||
class HcclTaskInfo : public TaskInfo { | |||
public: | |||
HcclTaskInfo(const std::string &op_name, uint32_t stream_id, const std::string hccl_type, void *input_data_addr, | |||
void *output_data_addr, int64_t workspace_size, int64_t hccl_stream_num, | |||
const std::vector<uint8_t> &private_def, void *ops_kernel_store, int32_t count, int64_t root_id, | |||
int64_t op_type, int64_t data_type, const std::string &group, bool dump_flag) | |||
: TaskInfo(op_name, stream_id, TaskInfoType::HCCL, dump_flag), | |||
hccl_type_(hccl_type), | |||
input_data_addr_(input_data_addr), | |||
output_data_addr_(output_data_addr), | |||
workspace_size_(workspace_size), | |||
hccl_stream_num_(hccl_stream_num), | |||
private_def_(private_def), | |||
ops_kernel_store_(ops_kernel_store), | |||
count_(count), | |||
root_id_(root_id), | |||
op_type_(op_type), | |||
data_type_(data_type), | |||
group_(group) {} | |||
~HcclTaskInfo() override {} | |||
const std::string &hccl_type() const { | |||
return hccl_type_; | |||
} | |||
void *input_data_addr() const { | |||
return input_data_addr_; | |||
} | |||
void *output_data_addr() const { | |||
return output_data_addr_; | |||
} | |||
int64_t workspace_size() const { | |||
return workspace_size_; | |||
} | |||
int64_t hccl_stream_num() const { | |||
return hccl_stream_num_; | |||
} | |||
const std::vector<uint8_t> &private_def() const { | |||
return private_def_; | |||
} | |||
void *ops_kernel_store() const { | |||
return ops_kernel_store_; | |||
} | |||
int32_t count() const { | |||
return count_; | |||
} | |||
int64_t root_id() const { | |||
return root_id_; | |||
} | |||
int64_t op_type() const { | |||
return op_type_; | |||
} | |||
int64_t data_type() const { | |||
return data_type_; | |||
} | |||
const std::string &group() const { | |||
return group_; | |||
} | |||
private: | |||
std::string hccl_type_; | |||
void *input_data_addr_; | |||
void *output_data_addr_; | |||
int64_t workspace_size_; | |||
int64_t hccl_stream_num_; | |||
std::vector<uint8_t> private_def_; | |||
void *ops_kernel_store_; | |||
int32_t count_; | |||
int64_t root_id_; | |||
int64_t op_type_; | |||
int64_t data_type_; | |||
std::string group_; | |||
}; | |||
class ProfilerTraceTaskInfo : public TaskInfo { | |||
public: | |||
ProfilerTraceTaskInfo(const std::string &op_name, uint32_t stream_id, uint64_t log_id, bool notify, uint32_t flat) | |||
: TaskInfo(op_name, stream_id, TaskInfoType::PROFILER_TRACE, false), | |||
log_id_(log_id), | |||
notify_(notify), | |||
flat_(flat) {} | |||
~ProfilerTraceTaskInfo() override {} | |||
uint64_t log_id() const { | |||
return log_id_; | |||
} | |||
bool notify() const { | |||
return notify_; | |||
} | |||
uint32_t flat() const { | |||
return flat_; | |||
} | |||
private: | |||
uint64_t log_id_; | |||
bool notify_; | |||
uint32_t flat_; | |||
}; | |||
class MemcpyAsyncTaskInfo : public TaskInfo { | |||
public: | |||
MemcpyAsyncTaskInfo(const std::string &op_name, uint32_t stream_id, void *dst, uint64_t dst_max, void *src, | |||
uint64_t count, uint32_t kind, bool dump_flag) | |||
: TaskInfo(op_name, stream_id, TaskInfoType::MEMCPY_ASYNC, dump_flag), | |||
dst_(dst), | |||
dst_max_(dst_max), | |||
src_(src), | |||
count_(count), | |||
kind_(kind) {} | |||
~MemcpyAsyncTaskInfo() override {} | |||
void *dst() const { | |||
return dst_; | |||
} | |||
uint64_t dst_max() const { | |||
return dst_max_; | |||
} | |||
void *src() const { | |||
return src_; | |||
} | |||
uint64_t count() const { | |||
return count_; | |||
} | |||
uint32_t kind() const { | |||
return kind_; | |||
} | |||
private: | |||
void *dst_; | |||
uint64_t dst_max_; | |||
void *src_; | |||
uint64_t count_; | |||
int32_t kind_; | |||
}; | |||
class StreamSwitchTaskInfo : public TaskInfo { | |||
public: | |||
StreamSwitchTaskInfo(const std::string &op_name, uint32_t stream_id, int64_t true_stream_id, void *input_addr, | |||
void *value_addr, int64_t cond, int64_t data_type) | |||
: TaskInfo(op_name, stream_id, TaskInfoType::STREAM_SWITCH, false), | |||
true_stream_id_(true_stream_id), | |||
input_addr_(input_addr), | |||
value_addr_(value_addr), | |||
cond_(cond), | |||
data_type_(data_type) {} | |||
~StreamSwitchTaskInfo() override {} | |||
int64_t true_stream_id() const { | |||
return true_stream_id_; | |||
} | |||
void *input_addr() const { | |||
return input_addr_; | |||
} | |||
void *value_addr() const { | |||
return value_addr_; | |||
} | |||
int64_t cond() const { | |||
return cond_; | |||
} | |||
int64_t data_type() const { | |||
return data_type_; | |||
} | |||
private: | |||
int64_t true_stream_id_; | |||
void *input_addr_; | |||
void *value_addr_; | |||
int64_t cond_; | |||
int64_t data_type_; | |||
}; | |||
class StreamActiveTaskInfo : public TaskInfo { | |||
public: | |||
StreamActiveTaskInfo(const std::string &op_name, uint32_t stream_id, uint32_t active_stream_id) | |||
: TaskInfo(op_name, stream_id, TaskInfoType::STREAM_ACTIVE, false), active_stream_id_(active_stream_id) {} | |||
~StreamActiveTaskInfo() override {} | |||
uint32_t active_stream_id() const { | |||
return active_stream_id_; | |||
} | |||
private: | |||
uint32_t active_stream_id_; | |||
}; | |||
} // namespace model_runner | |||
} // namespace ge | |||
#endif // INC_FRAMEWORK_GE_RUNTIME_TASK_INFO_H_ |
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -101,8 +101,8 @@ GE_FUNC_VISIBILITY Status SetOutputNodeInfo(ge::Graph &graph, const std::string | |||
GE_FUNC_VISIBILITY Status GetOutputLeaf(ge::NodePtr node, | |||
std::vector<std::pair<ge::NodePtr, int32_t>> &output_nodes_info); | |||
GE_FUNC_VISIBILITY void GetOutputNodesNameAndIndex(std::vector<std::pair<ge::NodePtr, int32_t>> &output_nodes_info, | |||
std::vector<std::string> &output_nodes_name); | |||
GE_FUNC_VISIBILITY void CreateOutputNodesInfo(std::vector<std::pair<ge::NodePtr, int32_t>> &output_nodes_info, | |||
std::vector<std::string> &output_nodes_name); | |||
GE_FUNC_VISIBILITY void UpdateOmgCtxWithParserCtx(); | |||
@@ -73,7 +73,9 @@ struct OMGBufferData { | |||
}; | |||
struct OmgContext { | |||
OmgContext() { format = DOMI_TENSOR_ND; } | |||
OmgContext() { | |||
format = DOMI_TENSOR_ND; | |||
} | |||
domiTensorFormat_t format; | |||
// format of the input specified by the command line | |||
@@ -96,14 +98,14 @@ struct OmgContext { | |||
// default out nodes (this is used for determing the orders) | |||
std::vector<std::pair<std::string, int32_t>> default_out_nodes; | |||
// save the output node of the network, value = topName, | |||
// topName indicates the output name of the operator. | |||
std::vector<std::string> user_out_nodes_top_vec; | |||
// tensorName indicates the output name of the operator. | |||
std::vector<std::string> user_out_tensors; | |||
// net out nodes (where user_out_nodes or leaf nodes) | |||
std::vector<std::string> net_out_nodes; | |||
// net out nodes top names(only caffe has top) | |||
std::vector<std::string> out_top_names; | |||
// net data nodes top names(only caffe has top) | |||
std::vector<std::string> data_top_names; | |||
// net out nodes tensor names(caffe or onnx) | |||
std::vector<std::string> out_tensor_names; | |||
// net data nodes tensor names(caffe or onnx) | |||
std::vector<std::string> data_tensor_names; | |||
// preferential format used by the entire network | |||
domiTensorFormat_t net_format = DOMI_TENSOR_RESERVED; | |||
domi::FrameworkType type = domi::FRAMEWORK_RESERVED; | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -46,14 +46,14 @@ struct ParserContext { | |||
// operator | |||
std::map<std::string, std::vector<int32_t>> out_nodes_map; | |||
// save the output node of the network, value = topName, | |||
// topName indicates the output name of the operator. | |||
std::vector<std::string> user_out_nodes_top_vec; | |||
// tensorName indicates the output name of the operator. | |||
std::vector<std::string> user_out_tensors; | |||
// net out nodes (where user_out_nodes or leaf nodes) | |||
std::vector<std::string> net_out_nodes; | |||
// net data nodes top names(only caffe has top) | |||
std::vector<std::string> data_top_names; | |||
// net out nodes top names(only caffe has top) | |||
std::vector<std::string> out_top_names; | |||
// net out nodes tensor names(caffe or onnx) | |||
std::vector<std::string> out_tensor_names; | |||
// net data nodes tensor names(caffe or onnx) | |||
std::vector<std::string> data_tensor_names; | |||
// Whether to use dynamic batch size or dynamic image size | |||
bool is_dynamic_input = false; | |||
bool train_flag = false; | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -1 +1 @@ | |||
Subproject commit 51418f61f26599c85bee2b57328afbbf1c9927c7 | |||
Subproject commit 2d1913e65a016e04a9599e1d2e49fd02136638bd |
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -77,4 +77,5 @@ | |||
#include "transformation_ops.h" | |||
#include "condtake_ops.h" | |||
#include "warp_perspective_ops.h" | |||
#include "vector_search.h" | |||
#endif // OPS_BUILT_IN_OP_PROTO_INC_ALL_OPS_H_ |
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1221,8 +1221,9 @@ REG_OP(Expand) | |||
REG_OP(NonZero) | |||
.INPUT(x, TensorType({DT_DOUBLE, DT_FLOAT, DT_FLOAT16, DT_INT8, DT_UINT8, DT_INT16, \ | |||
DT_UINT16, DT_INT32, DT_UINT32, DT_INT64, DT_UINT64, DT_BOOL})) | |||
.OUTPUT(y, TensorType({DT_INT64})) | |||
.OUTPUT(y, TensorType({DT_INT64, DT_INT32})) | |||
.ATTR(transpose, Bool, false) | |||
.ATTR(dtype, Type, DT_INT64) | |||
.OP_END_FACTORY_REG(NonZero) | |||
/** | |||
@@ -1249,6 +1250,32 @@ REG_OP(ExpandD) | |||
.OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8})) | |||
.REQUIRED_ATTR(shape, ListInt) | |||
.OP_END_FACTORY_REG(ExpandD) | |||
/** | |||
* @brief Calculate buckets limit and offset. \n | |||
* @par Inputs: | |||
* Three inputs, including: | |||
* @li bucket_list: A 1-D tensor of type int32 with the value of ivf_counts and ivf_offset index. \n | |||
* @li ivf_counts: A 1-D tensor of type int32 with the value of ivf counts. \n | |||
* @li ivf_offset: A 1-D tensor of type int32 with the value of ivf offset. \n | |||
* @par Attributes: | |||
* total_limit: A int64 type maximum value of the sum of ivf_counts corresponding to bucket_list. \n | |||
* @par Outputs: | |||
* @li buckets_limit: A 1-D tensor of type int32 with the sum <= total_limit. \n | |||
* @li buckets_offset: A 1-D tensor of type int32 with the value of ivf_offset corresponding to bucket_list. \n | |||
*/ | |||
REG_OP(CalcBucketsLimitAndOffset) | |||
.INPUT(bucket_list, TensorType({DT_INT32})) | |||
.INPUT(ivf_counts, TensorType({DT_INT32})) | |||
.INPUT(ivf_offset, TensorType({DT_INT32})) | |||
.OUTPUT(buckets_limit, TensorType({DT_INT32})) | |||
.OUTPUT(buckets_offset, TensorType({DT_INT32})) | |||
.REQUIRED_ATTR(total_limit, Int) | |||
.OP_END_FACTORY_REG(CalcBucketsLimitAndOffset) | |||
} // namespace ge | |||
#endif // OPS_BUILT_IN_OP_PROTO_INC_ARRAY_OPS_H_ |
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -137,10 +137,10 @@ REG_OP(MinimumGrad) | |||
REG_OP(Cast) | |||
.INPUT(x, TensorType({DT_BOOL, DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT32, DT_UINT8, | |||
DT_INT64, DT_UINT64, DT_INT16, DT_UINT16, DT_DOUBLE, DT_COMPLEX64, | |||
DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT16, DT_QUINT16, DT_QINT32})) | |||
DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT16, DT_QUINT16, DT_QINT32, DT_BF16})) | |||
.OUTPUT(y, TensorType({DT_BOOL, DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT32, DT_UINT8, | |||
DT_INT64, DT_UINT64, DT_INT16, DT_UINT16, DT_DOUBLE, DT_COMPLEX64, | |||
DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT16, DT_QUINT16, DT_QINT32})) | |||
DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT16, DT_QUINT16, DT_QINT32, DT_BF16})) | |||
.REQUIRED_ATTR(dst_type, Int) | |||
.OP_END_FACTORY_REG(Cast) | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,49 +0,0 @@ | |||
/** | |||
* Copyright 2019-2020 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. | |||
*/ | |||
/*! | |||
* \file globalavgpool.h | |||
* \brief | |||
*/ | |||
#ifndef OPS_BUILT_IN_OP_PROTO_INC_GLOBALAVERAGEPOOL_H_ | |||
#define OPS_BUILT_IN_OP_PROTO_INC_GLOBALAVERAGEPOOL_H_ | |||
#include "graph/operator_reg.h" | |||
namespace ge { | |||
/** | |||
*@brief GlobalAveragePool consumes an input tensor X and applies average pooling across the values in the same channel. | |||
This is equivalent to AveragePool with kernel size equal to the spatial dimension of input tensor \n | |||
*@par Inputs: | |||
*@li x: Input data tensor from the previous operator; dimensions for image case are (N x C x H x W), | |||
where N is the batch size, C is the number of channels, and H and W are the height and the width of the data. | |||
For non image case, the dimensions are in the form of (N x C x D1 x D2 ... Dn), where N is the batch size. | |||
*@par Outputs: | |||
*y: Output data tensor from pooling across the input tensor. The output tensor has the same rank as the input. | |||
The first two dimensions of output shape are the same as the input (N x C), while the other dimensions are all 1 | |||
*@par Restrictions: | |||
*Warning: This operator can be integrated only by configuring INSERT_OP_FILE of aclgrphBuildModel. Please do not use it directly. | |||
*/ | |||
REG_OP(GlobalAveragePool) | |||
.INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) | |||
.OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) | |||
.OP_END_FACTORY_REG(GlobalAveragePool) | |||
} // namespace ge | |||
#endif // OPS_BUILT_IN_OP_PROTO_INC_GLOBALAVGPOOL_H_ |
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1810,7 +1810,28 @@ REG_OP(GlobalLpPool) | |||
.INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) | |||
.OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) | |||
.ATTR(p, Float, 2.0) | |||
.OP_END_FACTORY_REG(GlobalLpPool); | |||
.OP_END_FACTORY_REG(GlobalLpPool) | |||
/** | |||
*@brief GlobalAveragePool consumes an input tensor X and applies average pooling across the values in the same channel. | |||
This is equivalent to AveragePool with kernel size equal to the spatial dimension of input tensor \n | |||
*@par Inputs: | |||
*@li x: Input data tensor from the previous operator; dimensions for image case are (N x C x H x W), | |||
where N is the batch size, C is the number of channels, and H and W are the height and the width of the data. | |||
For non image case, the dimensions are in the form of (N x C x D1 x D2 ... Dn), where N is the batch size. | |||
*@par Outputs: | |||
*y: Output data tensor from pooling across the input tensor. The output tensor has the same rank as the input. | |||
The first two dimensions of output shape are the same as the input (N x C), while the other dimensions are all 1 | |||
*@par Restrictions: | |||
*Warning: This operator can be integrated only by configuring INSERT_OP_FILE of aclgrphBuildModel. Please do not use it directly. | |||
*/ | |||
REG_OP(GlobalAveragePool) | |||
.INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) | |||
.OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) | |||
.OP_END_FACTORY_REG(GlobalAveragePool); | |||
} // namespace ge | |||
#endif // OPS_BUILT_IN_OP_PROTO_INC_NN_POOLING_OPS_H |
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -42,6 +42,45 @@ REG_OP(Gelu) | |||
.OP_END_FACTORY_REG(Gelu) | |||
/** | |||
* @brief Compute hard_swish of "x" element-wise . \n | |||
*@par Inputs: | |||
*One input, including: | |||
*x: A Tensor. Must be one of the following types: float16, float32 | |||
*@par Outputs: | |||
*y: A Tensor. Has the same type as "x". | |||
*@par Third-party framework compatibility | |||
* Compatible with the Torch operator HardSwish. | |||
*/ | |||
REG_OP(HardSwish) | |||
.INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) | |||
.OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) | |||
.OP_END_FACTORY_REG(HardSwish) | |||
/** | |||
*@brief Computes the for the Swish of "x" . \n | |||
*@par Inputs: | |||
*One input, including: | |||
*x: A Tensor. Must be one of the following types: float16, float32 | |||
*@par Outputs: | |||
*y: A Tensor. Has the same type as "x". | |||
*@par Attributes: | |||
*scale: scalar parameter, default value = 1.0 | |||
*@par Third-party framework compatibility | |||
*Compatible with the Torch operator Swish | |||
*/ | |||
REG_OP(Swish) | |||
.INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) | |||
.OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) | |||
.ATTR(scale, Float, 1.0) | |||
.OP_END_FACTORY_REG(Swish) | |||
/** | |||
*@brief Computes the gradient for the gelu of "x" . \n | |||
*@par Inputs: | |||
@@ -99,23 +138,6 @@ REG_OP(FastGeluGrad) | |||
.OP_END_FACTORY_REG(FastGeluGrad) | |||
/** | |||
* @brief Compute hardswish of "x" element-wise . \n | |||
*@par Inputs: | |||
*One input, including: | |||
*x: A Tensor. Must be one of the following types: float16, float32 | |||
*@par Outputs: | |||
*y: A Tensor. Has the same type as "x". | |||
*@par Third-party framework compatibility | |||
* Compatible with the Torch operator Hardswish. | |||
*/ | |||
REG_OP(Hardswish) | |||
.INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) | |||
.OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) | |||
.OP_END_FACTORY_REG(Hardswish) | |||
/** | |||
*@brief Computes the gradient for the tanh of "x" . \n | |||
*@par Inputs: | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2020 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -178,7 +178,7 @@ REG_OP(GatherNd) | |||
.OP_END_FACTORY_REG(GatherNd) | |||
/** | |||
*@brief Gather slices from "x" according to "indices" by corresponding axis . \n | |||
*@brief Gather slices from "x" according to "indices" by corresponding axis . | |||
*@par Inputs: | |||
*Three inputs, including: | |||
@@ -187,16 +187,19 @@ REG_OP(GatherNd) | |||
* uint16, complex128, float16, uint32, uint64, complex64, complex128. | |||
* @li indices: A Tensor of type int32 or int64. | |||
* @li axis: A Tensor of type as int32 or int64, | |||
* Must be in the range [-rank(input_tensor), rank(input_tensor)) . \n | |||
* Must be in the range [-rank(input_tensor), rank(input_tensor)) . | |||
*@par Attributes: | |||
* batch_dims: An optional int. Defaults to 0. | |||
*@par Outputs: | |||
*y: A Tensor. Has the same type as "x" . \n | |||
*y: A Tensor. Has the same type as "x" . | |||
*@attention Constraints: | |||
*Value in indices must be in range [0, x.shape[axis]) | |||
*@par Third-party framework compatibility | |||
* Compatible with the TensorFlow operator GatherV2 . \n | |||
* Compatible with the TensorFlow operator GatherV2 . | |||
*/ | |||
REG_OP(GatherV2) | |||
@@ -204,6 +207,7 @@ REG_OP(GatherV2) | |||
.INPUT(indices, TensorType::IndexNumberType()) | |||
.INPUT(axis, TensorType::IndexNumberType()) | |||
.OUTPUT(y, TensorType::BasicType()) | |||
.ATTR(batch_dims, Int, 0) | |||
.OP_END_FACTORY_REG(GatherV2) | |||
/** | |||
@@ -1216,19 +1220,20 @@ REG_OP(StridedSliceAssignD) | |||
* @li x: A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8, | |||
* int64, qint8, quint8, qint32, qint16, quint16, uint16, | |||
* float16, uint32, uint64, complex64, complex128. | |||
* @li indices: A Tensor of type int32 or int64 . \n | |||
* @li indices: A Tensor of type int32 or int64 . | |||
*@par Attributes: | |||
*validate_indices: A bool specifying whether to verify the argument of "indice" . \n | |||
* @li validate_indices: A bool specifying whether to verify the argument of "indice" . | |||
* @li batch_dims: An optional int. Defaults to 0. | |||
*@par Outputs: | |||
*y: A Tensor. Has the same type as "x" . \n | |||
*y: A Tensor. Has the same type as "x" . | |||
*@attention Constraints: | |||
* "indices" is in the range [0, x.shape[0]) . \n | |||
* "indices" is in the range [0, x.shape[0]) . | |||
*@par Third-party framework compatibility | |||
* Compatible with the TensorFlow operator Gather . \n | |||
* Compatible with the TensorFlow operator Gather . | |||
*/ | |||
REG_OP(Gather) | |||
@@ -1236,6 +1241,7 @@ REG_OP(Gather) | |||
.INPUT(indices, TensorType::IndexNumberType()) | |||
.OUTPUT(y, TensorType::BasicType()) | |||
.ATTR(validate_indices, Bool, true) | |||
.ATTR(batch_dims, Int, 0) | |||
.OP_END_FACTORY_REG(Gather) | |||
/** | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -0,0 +1,48 @@ | |||
/** | |||
* 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. | |||
*/ | |||
/*! | |||
* \file vector_search.h | |||
* \brief | |||
*/ | |||
#ifndef OPS_BUILT_IN_OP_PROTO_INC_VECTOR_SEARCH_H_ | |||
#define OPS_BUILT_IN_OP_PROTO_INC_VECTOR_SEARCH_H_ | |||
#include "graph/operator_reg.h" | |||
namespace ge { | |||
/** | |||
* @brief Generate ADC(asymmetric distance computation) table. \n | |||
* | |||
* @par Inputs: | |||
* Four inputs, including: | |||
* @li query: A Tensor. Must be one of the following types: float16, float32. | |||
* @li code_book: A Tensor. Must be one of the following types: float16, float32. | |||
* @li centroids: A Tensor. Must be one of the following types: float16, float32. | |||
* @li bucket_list: A Tensor. Must be one of the following types: int32, int64. | |||
* | |||
* @par Outputs: | |||
* @li adc_tables: A Tensor. Must be one of the following types: float16, float32. | |||
*/ | |||
REG_OP(GenADC) | |||
.INPUT(query, TensorType({DT_FLOAT16, DT_FLOAT})) | |||
.INPUT(code_book, TensorType({DT_FLOAT16, DT_FLOAT})) | |||
.INPUT(centroids, TensorType({DT_FLOAT16, DT_FLOAT})) | |||
.INPUT(bucket_list, TensorType({DT_INT32, DT_INT64})) | |||
.OUTPUT(adc_tables, TensorType({DT_FLOAT16, DT_FLOAT})) | |||
.OP_END_FACTORY_REG(GenADC) | |||
} // namespace ge | |||
#endif // OPS_BUILT_IN_OP_PROTO_INC_VECTOR_SEARCH_H_ |
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* Copyright 2019 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. | |||
@@ -1,18 +1,18 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* | |||
* Copyright 2020 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 __CCE_RUNTIME_BASE_H__ | |||
#define __CCE_RUNTIME_BASE_H__ | |||
@@ -38,6 +38,16 @@ static const int32_t RT_ERROR_NONE = 0; // success | |||
/** | |||
* @ingroup dvrt_base | |||
* @brief device mode. | |||
*/ | |||
typedef enum tagRtDeviceMode { | |||
RT_DEVICE_MODE_SINGLE_DIE = 0, | |||
RT_DEVICE_MODE_MULTI_DIE = 1, | |||
RT_DEVICE_MODE_RESERVED | |||
} rtDeviceMode; | |||
/** | |||
* @ingroup dvrt_base | |||
* @brief runtime exception numbers. | |||
*/ | |||
typedef enum tagRtExceptionType { | |||
@@ -172,18 +182,6 @@ RTS_API rtError_t rtProfilerConfig(uint16_t type); | |||
/** | |||
* @ingroup profiling_base | |||
* @brief start rts profiler. | |||
*/ | |||
RTS_API rtError_t rtProfilerStart(uint64_t profConfig, int32_t numsDev, uint32_t *deviceList); | |||
/** | |||
* @ingroup profiling_base | |||
* @brief stop rts profiler. | |||
*/ | |||
RTS_API rtError_t rtProfilerStop(uint64_t profConfig, int32_t numsDev, uint32_t *deviceList); | |||
/** | |||
* @ingroup profiling_base | |||
* @brief ts send keypoint profiler log. | |||
*/ | |||
RTS_API rtError_t rtProfilerTrace(uint64_t id, bool notify, uint32_t flags, rtStream_t stream); | |||
@@ -1,18 +1,18 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* | |||
* Copyright 2020 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 __CCE_RUNTIME_CONFIG_H__ | |||
#define __CCE_RUNTIME_CONFIG_H__ | |||
@@ -1,18 +1,18 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* | |||
* Copyright 2020 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 __CCE_RUNTIME_CONTEXT_H__ | |||
#define __CCE_RUNTIME_CONTEXT_H__ | |||
@@ -66,6 +66,17 @@ RTS_API rtError_t rtCtxCreate(rtContext_t *ctx, uint32_t flags, int32_t device); | |||
* @param [out] ctx created context | |||
* @param [in] flags context creation flag. set to 0. | |||
* @param [in] device device to create context on | |||
* @param [in] deviceMode the device mode | |||
* @return RT_ERROR_NONE for ok | |||
*/ | |||
RTS_API rtError_t rtCtxCreateV2(rtContext_t *ctx, uint32_t flags, int32_t device, rtDeviceMode deviceMode); | |||
/** | |||
* @ingroup rt_context | |||
* @brief create context and associates it with the calling thread | |||
* @param [out] ctx created context | |||
* @param [in] flags context creation flag. set to 0. | |||
* @param [in] device device to create context on | |||
* @return RT_ERROR_NONE for ok | |||
*/ | |||
RTS_API rtError_t rtCtxCreateEx(rtContext_t *ctx, uint32_t flags, int32_t device); | |||
@@ -1,18 +1,18 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* | |||
* Copyright 2020 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 __CCE_RUNTIME_DEVICE_H__ | |||
#define __CCE_RUNTIME_DEVICE_H__ | |||
@@ -154,6 +154,34 @@ RTS_API rtError_t rtSetDevice(int32_t device); | |||
* @ingroup dvrt_dev | |||
* @brief set target device for current thread | |||
* @param [int] device the device id | |||
* @param [int] deviceMode the device mode | |||
* @return RT_ERROR_NONE for ok | |||
* @return RT_ERROR_INVALID_VALUE for error input | |||
*/ | |||
RTS_API rtError_t rtSetDeviceV2(int32_t device, rtDeviceMode deviceMode); | |||
/** | |||
* @ingroup dvrt_dev | |||
* @brief set target die for current thread | |||
* @param [int] die the die id | |||
* @return RT_ERROR_NONE for ok | |||
* @return RT_ERROR_INVALID_VALUE for error input | |||
*/ | |||
RTS_API rtError_t rtSetDie(int32_t die); | |||
/** | |||
* @ingroup dvrt_dev | |||
* @brief get target die of current thread | |||
* @param [in|out] die the die id | |||
* @return RT_ERROR_NONE for ok | |||
* @return RT_ERROR_INVALID_VALUE for error input | |||
*/ | |||
RTS_API rtError_t rtGetDie(int32_t *die); | |||
/** | |||
* @ingroup dvrt_dev | |||
* @brief set target device for current thread | |||
* @param [int] device the device id | |||
* @return RT_ERROR_NONE for ok | |||
* @return RT_ERROR_INVALID_VALUE for error input | |||
*/ | |||
@@ -1,18 +1,18 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* | |||
* Copyright 2020 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 __CCE_RUNTIME_DVFSPROFILE_H__ | |||
#define __CCE_RUNTIME_DVFSPROFILE_H__ | |||
@@ -1,18 +1,18 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* | |||
* Copyright 2020 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 __CCE_RUNTIME_EVENT_H__ | |||
#define __CCE_RUNTIME_EVENT_H__ | |||
@@ -1,18 +1,18 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* | |||
* Copyright 2020 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 __CCE_RUNTIME_KERNEL_H__ | |||
#define __CCE_RUNTIME_KERNEL_H__ | |||
@@ -1,18 +1,18 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* | |||
* Copyright 2020 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 __CCE_RUNTIME_MEM_H__ | |||
#define __CCE_RUNTIME_MEM_H__ | |||