You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.7 KiB
76 lines
2.7 KiB
5 years ago
|
/**
|
||
|
* 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 GE_GRAPH_PREPROCESS_MULTI_BATCH_OPTIONS_H_
|
||
|
#define GE_GRAPH_PREPROCESS_MULTI_BATCH_OPTIONS_H_
|
||
|
|
||
|
#include <vector>
|
||
|
|
||
|
#include "external/ge/ge_api_error_codes.h"
|
||
|
#include "graph/ge_tensor.h"
|
||
|
#include "graph/op_desc.h"
|
||
|
#include "graph/node.h"
|
||
|
|
||
|
namespace ge {
|
||
|
namespace multibatch {
|
||
|
///
|
||
|
/// @ingroup ge
|
||
|
/// @brief Init Dynamic Param from Options.
|
||
|
/// @param [out] std::vector<std::vector<int64_t>> &shapes: Result for Params.
|
||
|
/// @return true: Configed for Multi batch / false: Not configed for Multi batch.
|
||
|
///
|
||
|
bool InitDynamicParams(std::vector<std::vector<int64_t>> &shapes);
|
||
|
|
||
|
///
|
||
|
/// @ingroup ge
|
||
|
/// @brief Check Dynamic Param is invalid.
|
||
|
/// @param [in] const vector<vector<int64_t>> &shapes: Params for check.
|
||
|
/// @return SUCCESS: valid / PARAM_INVALID: invalid.
|
||
|
///
|
||
|
Status CheckDynamicParams(const std::vector<std::vector<int64_t>> &shapes);
|
||
|
|
||
|
///
|
||
|
/// @ingroup ge
|
||
|
/// @brief Get GeShape from configed shape.
|
||
|
/// @param [in] const std::vector<int64_t> &batch_shape: Configed shape.
|
||
|
/// @param [out] GeShape &data_shape: GeShape for configed shape.
|
||
|
/// @return SUCCESS / PARAM_INVALID
|
||
|
///
|
||
|
Status CalcShape(const std::vector<int64_t> &batch_shape, GeShape &data_shape);
|
||
|
|
||
|
///
|
||
|
/// @ingroup ge
|
||
|
/// @brief parse each data's own dynamic dims.
|
||
4 years ago
|
/// @param [in] vector<vector<int64_t>> &shapes: dynamic batch gears info.
|
||
|
/// @param [in] vector<pair<string, vector<int64_t>>> data_name_and_shape: eg:{{data:{1,1,-1,2}}}.
|
||
5 years ago
|
/// @param [out] map<string, vector<vector<int64_t>>> &data_to_dynamic_info: key:data_name. value:dynamic dims.
|
||
|
/// @return SUCCESS / PARAM_INVALID
|
||
|
///
|
||
|
Status ParserDataToDynmaicInfo(const vector<vector<int64_t>> &shapes,
|
||
4 years ago
|
vector<pair<string, vector<int64_t>>> &data_name_and_shape,
|
||
5 years ago
|
map<string, vector<vector<int64_t>>> &data_to_dynamic_info);
|
||
|
|
||
|
///
|
||
|
/// @ingroup ge
|
||
|
/// @brief Set mbatch_dynamic_type on node.
|
||
|
/// @param [in] const OpDescPtr &op_desc: Node for set attribute.
|
||
|
/// @return 0: SUCCESS / others: INTERNAL_ERROR
|
||
|
///
|
||
|
Status StampDynamicType(const OpDescPtr &op_desc);
|
||
|
} // namespace multibatch
|
||
|
} // namespace ge
|
||
|
#endif // GE_GRAPH_PREPROCESS_MULTI_BATCH_OPTIONS_H_
|