!20644 fix format issue
Merge pull request !20644 from zhujingxuan/format
This commit is contained in:
commit
2ae65ae387
|
@ -256,5 +256,4 @@ void CoderGraph::DumpUnSupportLayer(Target target) {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace mindspore::lite::micro
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
using mindspore::schema::PrimitiveType_Cast;
|
||||
namespace mindspore::lite::micro {
|
||||
|
||||
int DTypeCastCoder::Prepare(CoderContext *const context) {
|
||||
data_num_ = input_tensor_->ElementsNum();
|
||||
if (data_num_ == 0) {
|
||||
|
|
|
@ -43,7 +43,7 @@ int ReduceBaseCoder::CheckParameters() {
|
|||
}
|
||||
|
||||
for (auto i = 0; i < num_axes_; i++) {
|
||||
if (axes_[i] < -static_cast<int>(input_rank) || axes_[i] >= static_cast<int>(input_rank)) {
|
||||
if ((axes_[i] < -static_cast<int>(input_rank)) || (axes_[i] >= static_cast<int>(input_rank))) {
|
||||
MS_LOG(ERROR) << "Reduce got invalid axis " << axes_[i] << ", axis should be in ["
|
||||
<< -static_cast<int>(input_rank) << ", " << input_rank - 1 << "].";
|
||||
return RET_ERROR;
|
||||
|
|
|
@ -28,7 +28,6 @@ using mindspore::schema::PrimitiveType_Squeeze;
|
|||
using mindspore::schema::PrimitiveType_Unsqueeze;
|
||||
|
||||
namespace mindspore::lite::micro {
|
||||
|
||||
int ReshapeBaseCoder::Prepare(CoderContext *const context) { return RET_OK; }
|
||||
|
||||
int ReshapeBaseCoder::DoCode(CoderContext *const context) {
|
||||
|
@ -51,5 +50,4 @@ REG_OPERATOR_CODER(kAllTargets, kNumberTypeFloat32, PrimitiveType_Squeeze, CPUOp
|
|||
REG_OPERATOR_CODER(kAllTargets, kNumberTypeInt32, PrimitiveType_Squeeze, CPUOpCoderCreator<ReshapeBaseCoder>)
|
||||
REG_OPERATOR_CODER(kAllTargets, kNumberTypeFloat32, PrimitiveType_Unsqueeze, CPUOpCoderCreator<ReshapeBaseCoder>)
|
||||
REG_OPERATOR_CODER(kAllTargets, kNumberTypeInt32, PrimitiveType_Unsqueeze, CPUOpCoderCreator<ReshapeBaseCoder>)
|
||||
|
||||
} // namespace mindspore::lite::micro
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <type_traits>
|
||||
|
||||
namespace mindspore::lite::micro {
|
||||
|
||||
int SoftmaxBaseCoder::Init() {
|
||||
this->softmax_param_ = reinterpret_cast<SoftmaxParameter *>(parameter_);
|
||||
std::vector<int> in_shape = input_tensor_->shape();
|
||||
|
@ -52,5 +51,4 @@ int SoftmaxBaseCoder::ReSize() {
|
|||
softmax_param_->element_size_ = ele_size;
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
} // namespace mindspore::lite::micro
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
using mindspore::schema::PrimitiveType_AddFusion;
|
||||
|
||||
namespace mindspore::lite::micro::cmsis {
|
||||
|
||||
int AddInt8Coder::Prepare(CoderContext *const context) {
|
||||
input1_ = input_tensors_.at(0);
|
||||
input2 = input_tensors_.at(1);
|
||||
|
@ -51,13 +50,13 @@ int AddInt8Coder::Prepare(CoderContext *const context) {
|
|||
const double real_output_multiplier =
|
||||
twice_max_input_scale / ((1 << static_cast<size_t>(left_shift_)) * static_cast<double>(output_scale));
|
||||
|
||||
MS_CHECK_TRUE(0 <= real_input1_multiplier && real_input1_multiplier <= 1,
|
||||
MS_CHECK_TRUE((real_input1_multiplier >= 0) && (real_input1_multiplier <= 1),
|
||||
"real_input1_multiplier should be in (0, 1)");
|
||||
QuantizeMultiplier(real_input1_multiplier, &input_1_mult_, &input_1_shift_);
|
||||
MS_CHECK_TRUE(0 <= real_input2_multiplier && real_input2_multiplier <= 1,
|
||||
MS_CHECK_TRUE((real_input2_multiplier >= 0) && (real_input2_multiplier <= 1),
|
||||
"real_input2_multiplier should be in (0, 1)");
|
||||
QuantizeMultiplier(real_input2_multiplier, &input_2_mult_, &input_2_shift_);
|
||||
MS_CHECK_TRUE(0 <= real_output_multiplier && real_output_multiplier <= 1,
|
||||
MS_CHECK_TRUE((real_output_multiplier >= 0) && (real_output_multiplier <= 1),
|
||||
"real_output_multiplier should be in (0, 1)");
|
||||
QuantizeMultiplier(real_output_multiplier, &out_mult_, &out_shift_);
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nnacl/int8/quantize.h"
|
||||
|
||||
namespace mindspore::lite::micro::cmsis {
|
||||
|
||||
int Conv2DBaseCoder::SetQuantArgs() {
|
||||
int channel = output_tensor_->Channel();
|
||||
size_t channel_data_size = static_cast<size_t>(channel) * sizeof(int32_t);
|
||||
|
@ -56,5 +55,4 @@ int Conv2DBaseCoder::SetQuantArgs() {
|
|||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
} // namespace mindspore::lite::micro::cmsis
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
using mindspore::schema::PrimitiveType_Conv2DFusion;
|
||||
|
||||
namespace mindspore::lite::micro::cmsis {
|
||||
|
||||
int Conv2DInt8Coder::Prepare(CoderContext *const context) {
|
||||
Conv2DBaseCoder::Init();
|
||||
MS_CHECK_RET_CODE(micro::Conv2DBaseCoder::CheckLayout(input_tensor_), "CheckLayout failed");
|
||||
|
@ -97,9 +96,9 @@ int Conv2DInt8Coder::DoCode(CoderContext *const context) {
|
|||
}
|
||||
|
||||
int Conv2DInt8Coder::SetParameters() {
|
||||
MS_CHECK_TRUE(input_tensor_->Channel() == filter_tensor_->DimensionSize(3),
|
||||
MS_CHECK_TRUE(input_tensor_->Channel() == filter_tensor_->DimensionSize(kNHWC_C),
|
||||
"input Channel and filter size not match!");
|
||||
MS_CHECK_TRUE(output_tensor_->Channel() == filter_tensor_->DimensionSize(0),
|
||||
MS_CHECK_TRUE(output_tensor_->Channel() == filter_tensor_->DimensionSize(kNHWC_N),
|
||||
"output Channel and filter size not match!");
|
||||
|
||||
input_x_ = input_tensor_->Width();
|
||||
|
@ -107,8 +106,8 @@ int Conv2DInt8Coder::SetParameters() {
|
|||
input_ch_ = input_tensor_->Channel();
|
||||
input_batches_ = input_tensor_->Batch();
|
||||
|
||||
kernel_x_ = filter_tensor_->DimensionSize(2);
|
||||
kernel_y_ = filter_tensor_->DimensionSize(1);
|
||||
kernel_x_ = filter_tensor_->DimensionSize(kNHWC_W);
|
||||
kernel_y_ = filter_tensor_->DimensionSize(kNHWC_H);
|
||||
pad_x_ = conv_param_->pad_l_;
|
||||
pad_y_ = conv_param_->pad_u_;
|
||||
|
||||
|
@ -123,8 +122,8 @@ int Conv2DInt8Coder::SetParameters() {
|
|||
input_offset_ = -input_quant_arg.zeroPoint;
|
||||
out_offset_ = output_quant_arg.zeroPoint;
|
||||
|
||||
output_x_ = output_tensor_->DimensionSize(2);
|
||||
output_y_ = output_tensor_->DimensionSize(1);
|
||||
output_x_ = output_tensor_->DimensionSize(kNHWC_W);
|
||||
output_y_ = output_tensor_->DimensionSize(kNHWC_H);
|
||||
output_ch_ = output_tensor_->Channel();
|
||||
|
||||
CalculateActivationRangeQuantized(conv_param_->act_type_ == ActType_Relu, conv_param_->act_type_ == ActType_Relu6,
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "coder/log.h"
|
||||
|
||||
namespace mindspore::lite::micro::cmsis {
|
||||
|
||||
int DWConvInt8Coder::Prepare(CoderContext *const context) {
|
||||
Conv2DBaseCoder::Init();
|
||||
MS_CHECK_RET_CODE(micro::Conv2DBaseCoder::CheckLayout(input_tensor_), "Check layout failed.");
|
||||
|
@ -157,5 +156,4 @@ int DWConvInt8Coder::InitTmpBuffer() {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace mindspore::lite::micro::cmsis
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
using mindspore::schema::PrimitiveType_FullConnection;
|
||||
|
||||
namespace mindspore::lite::micro::cmsis {
|
||||
|
||||
int FullConnectionInt8Coder::Prepare(CoderContext *const context) {
|
||||
FullConnectionBaseCoder::Init();
|
||||
ConfigInputOutput();
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
using mindspore::schema::PrimitiveType_MulFusion;
|
||||
|
||||
namespace mindspore::lite::micro::cmsis {
|
||||
|
||||
int MulInt8Coder::Prepare(CoderContext *const context) {
|
||||
input1_ = OperatorCoder::input_tensors().at(0);
|
||||
input2_ = OperatorCoder::input_tensors().at(1);
|
||||
|
|
|
@ -105,5 +105,4 @@ int PoolingInt8Coder::SetParameters() {
|
|||
|
||||
REG_OPERATOR_CODER(kARM32M, kNumberTypeInt8, PrimitiveType_AvgPoolFusion, CPUOpCoderCreator<PoolingInt8Coder>)
|
||||
REG_OPERATOR_CODER(kARM32M, kNumberTypeInt8, PrimitiveType_MaxPoolFusion, CPUOpCoderCreator<PoolingInt8Coder>)
|
||||
|
||||
} // namespace mindspore::lite::micro::cmsis
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
using mindspore::schema::PrimitiveType_Reshape;
|
||||
|
||||
namespace mindspore::lite::micro::cmsis {
|
||||
|
||||
int ReshapeInt8Coder::DoCode(CoderContext *const context) {
|
||||
int elements_num = input_tensor_->ElementsNum();
|
||||
|
||||
|
@ -47,5 +46,4 @@ int ReshapeInt8Coder::DoCode(CoderContext *const context) {
|
|||
}
|
||||
|
||||
REG_OPERATOR_CODER(kARM32M, kNumberTypeInt8, PrimitiveType_Reshape, CPUOpCoderCreator<ReshapeInt8Coder>)
|
||||
|
||||
} // namespace mindspore::lite::micro::cmsis
|
||||
|
|
|
@ -115,5 +115,4 @@ int ReduceFP32Coder::DoCode(CoderContext *const context) {
|
|||
}
|
||||
|
||||
REG_OPERATOR_CODER(kAllTargets, kNumberTypeFloat32, PrimitiveType_ReduceFusion, CPUOpCoderCreator<ReduceFP32Coder>)
|
||||
|
||||
} // namespace mindspore::lite::micro::nnacl
|
||||
|
|
|
@ -28,7 +28,6 @@ using mindspore::schema::CoordinateTransformMode_HALF_PIXEL;
|
|||
using mindspore::schema::PrimitiveType_Resize;
|
||||
|
||||
namespace mindspore::lite::micro::nnacl {
|
||||
|
||||
int ResizeFP32Coder::Prepare(CoderContext *const context) {
|
||||
MS_CHECK_RET_CODE(ResizeBaseCoder::Init(), "ResizeBaseCoder::Init failed");
|
||||
MS_CHECK_RET_CODE(SelectCalculatorFunc(), "SelectCalculatorFunc failed");
|
||||
|
@ -63,8 +62,8 @@ int ResizeFP32Coder::ReSize() {
|
|||
}
|
||||
|
||||
if (!const_shape_) {
|
||||
new_height_ = output_tensor_->shape()[1];
|
||||
new_width_ = output_tensor_->shape()[2];
|
||||
new_height_ = output_tensor_->shape().at(kNHWC_H);
|
||||
new_width_ = output_tensor_->shape().at(kNHWC_W);
|
||||
}
|
||||
|
||||
MS_CHECK_RET_CODE_WITH_EXE(MallocTmpBuffer(), "MallocTmpBuffer failed", FreeTmpBuffer());
|
||||
|
@ -73,13 +72,10 @@ int ResizeFP32Coder::ReSize() {
|
|||
return RET_OK;
|
||||
}
|
||||
|
||||
// Bilinear interpolation :
|
||||
// Bilinear interpolation considers the closest 2x2 neighborhood of known pixel values surrounding the unknown pixel.
|
||||
// It takes a weighted average of these 4 pixels to arrive at its final interpolated value. Thus, we need to reserve
|
||||
// twice bigger space than coordinates arrays for weight arrays. It means x_weight_len is twice as much as x_len in
|
||||
// detail.
|
||||
//
|
||||
// Bicubic interpolation:
|
||||
// Bicubic goes one step beyond bilinear by considering the closest 4x4 neighborhood of known pixels --- for a total of
|
||||
// 16 pixels. Since these are at various distances from the unknown pixel, closer pixels are given a higher weighting in
|
||||
// the calculation.
|
||||
|
@ -178,7 +174,7 @@ int ResizeFP32Coder::DoCode(CoderContext *const context) {
|
|||
code.CodeArray("y_weights", y_weights_, sizeof(float) * y_weight_len_, true);
|
||||
code.CodeArray("x_weights", x_weights_, sizeof(float) * x_weight_len_, true);
|
||||
|
||||
int c = input_tensor_->shape().at(3);
|
||||
int c = input_tensor_->shape().at(kNHWC_C);
|
||||
code << "float *line0 = " << MemoryAllocator::GetInstance()->GetRuntimeAddr(line_buffer_) << ";\n";
|
||||
code << "float *line1 = line0 + " << new_width_ << " * " << c << ";\n";
|
||||
code.CodeFunction("ResizeBilinear", input_tensor_, output_tensor_, "input_shape", "output_shape", "y_bottoms",
|
||||
|
|
|
@ -64,5 +64,4 @@ int SoftMaxFP32Coder::DoCode(CoderContext *const context) {
|
|||
}
|
||||
|
||||
REG_OPERATOR_CODER(kAllTargets, kNumberTypeFloat32, PrimitiveType_Softmax, CPUOpCoderCreator<SoftMaxFP32Coder>)
|
||||
|
||||
} // namespace mindspore::lite::micro::nnacl
|
||||
|
|
|
@ -21,7 +21,6 @@ using mindspore::schema::PrimitiveType_Affine;
|
|||
|
||||
namespace mindspore {
|
||||
namespace lite {
|
||||
|
||||
static void ReleaseParam(AffineParameter *affine, MatMulParameter *matmul) {
|
||||
if (affine != nullptr) {
|
||||
free(affine);
|
||||
|
|
|
@ -23,7 +23,6 @@ using mindspore::schema::PrimitiveType_TensorArrayWrite;
|
|||
|
||||
namespace mindspore {
|
||||
namespace lite {
|
||||
|
||||
OpParameter *PopulateTensorArrayParameter(const void *prim) {
|
||||
auto primitive = static_cast<const schema::Primitive *>(prim);
|
||||
MS_ASSERT(primitive != nullptr);
|
||||
|
|
|
@ -29,9 +29,11 @@ using mindspore::lite::RET_OK;
|
|||
using mindspore::lite::RET_PARAM_INVALID;
|
||||
using mindspore::schema::PrimitiveType_Affine;
|
||||
namespace mindspore::kernel {
|
||||
|
||||
constexpr auto kAffineMinInputNum = 3;
|
||||
constexpr auto kAffineMaxInputNum = 4;
|
||||
constexpr auto kAffineMaxOutputNum = 1;
|
||||
constexpr auto kInputRow = 1;
|
||||
constexpr auto kInputCol = 2;
|
||||
|
||||
int AffineFp32CPUKernel::DoActivation(lite::Tensor *tensor) {
|
||||
auto data = static_cast<float *>(tensor->MutableData());
|
||||
|
@ -127,10 +129,10 @@ int AffineFp32CPUKernel::FullRunInit() {
|
|||
return RET_ERROR;
|
||||
}
|
||||
// src and dst shape: {batch, row, col}
|
||||
splice_src_row_ = src_shape.at(1);
|
||||
splice_src_col_ = src_shape.at(2);
|
||||
splice_dst_row_ = dst_shape.at(1);
|
||||
splice_dst_col_ = dst_shape.at(2);
|
||||
splice_src_row_ = src_shape.at(kInputRow);
|
||||
splice_src_col_ = src_shape.at(kInputCol);
|
||||
splice_dst_row_ = dst_shape.at(kInputRow);
|
||||
splice_dst_col_ = dst_shape.at(kInputCol);
|
||||
if (splice_src_col_ * affine_parameter_->context_size_ != splice_dst_col_) {
|
||||
MS_LOG(ERROR) << "splice kernel src_col not match dst_col";
|
||||
return RET_ERROR;
|
||||
|
@ -155,7 +157,7 @@ int AffineFp32CPUKernel::IncrementInit() {
|
|||
// For affine op, the possible inputs are:
|
||||
// { input, weight, bias, tensor_array_read }
|
||||
// { input, weight, tensor_array_read }
|
||||
if (in_tensors_.size() == 4) {
|
||||
if (in_tensors_.size() == kAffineMaxInputNum) {
|
||||
tensor_read_ = in_tensors_.at(3);
|
||||
} else {
|
||||
tensor_read_ = in_tensors_.at(2);
|
||||
|
@ -163,8 +165,8 @@ int AffineFp32CPUKernel::IncrementInit() {
|
|||
|
||||
auto out_tensor = out_tensors_.at(kOutputIndex);
|
||||
auto out_shape = out_tensor->shape();
|
||||
matmul_col_ = out_shape.back();
|
||||
matmul_row_ = out_shape.at(out_shape.size() - 2);
|
||||
matmul_col_ = out_shape.at(kInputCol);
|
||||
matmul_row_ = out_shape.at(kInputRow);
|
||||
if (out_tensor->Size() != matmul_row_ * matmul_col_ * sizeof(float)) {
|
||||
MS_LOG(ERROR) << "size mismatch!";
|
||||
MS_LOG(ERROR) << "out_tensor->Size() = " << out_tensor->Size();
|
||||
|
@ -257,7 +259,7 @@ kernel::InnerKernel *AffineFp32CPUKernel::FullMatmulKernelCreate() {
|
|||
// For affine op, the possible inputs are:
|
||||
// { input, weight, bias, tensor_array_read }
|
||||
// { input, weight, tensor_array_read }
|
||||
if (in_tensors_.size() == 4) {
|
||||
if (in_tensors_.size() == kAffineMaxInputNum) {
|
||||
input_tensors = {full_input_, in_tensors_.at(kWeightIndex), in_tensors_.at(kBiasIndex)};
|
||||
} else {
|
||||
input_tensors = {full_input_, in_tensors_.at(kWeightIndex)};
|
||||
|
@ -302,7 +304,7 @@ kernel::InnerKernel *AffineFp32CPUKernel::IncrementMatmulKernelCreate() {
|
|||
increment_output_ = new lite::Tensor(kNumberTypeFloat32, {1, 1, matmul_col});
|
||||
increment_output_->MallocData();
|
||||
|
||||
if (in_tensors_.size() < 3) {
|
||||
if (in_tensors_.size() < kAffineMinInputNum) {
|
||||
MS_LOG(ERROR) << "wrong affine input size";
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -311,7 +313,7 @@ kernel::InnerKernel *AffineFp32CPUKernel::IncrementMatmulKernelCreate() {
|
|||
// For affine op, the possible inputs are:
|
||||
// { input, weight, bias, tensor_array_read }
|
||||
// { input, weight, tensor_array_read }
|
||||
if (in_tensors_.size() == 4) {
|
||||
if (in_tensors_.size() == kAffineMaxInputNum) {
|
||||
input_tensors = {increment_input_, in_tensors_.at(kWeightIndex), in_tensors_.at(kBiasIndex)};
|
||||
} else {
|
||||
input_tensors = {increment_input_, in_tensors_.at(kWeightIndex)};
|
||||
|
|
|
@ -32,7 +32,6 @@ using mindspore::schema::PrimitiveType_TensorArrayRead;
|
|||
using mindspore::schema::PrimitiveType_TensorArrayWrite;
|
||||
|
||||
namespace mindspore::kernel {
|
||||
|
||||
constexpr int kTensorArrayReadInSize = 3;
|
||||
constexpr int kTensorArrayWriteInSize = 4;
|
||||
constexpr int kHandleIndex = 0;
|
||||
|
|
|
@ -26,9 +26,7 @@
|
|||
#include "tools/optimizer/parallel/spliter.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
||||
namespace opt {
|
||||
|
||||
const BaseRef EliminateConcatSplit::DefinePattern() const {
|
||||
auto concat_var = std::make_shared<CondVar>(IsConcatNode);
|
||||
auto split_prim = std::make_shared<ops::SplitWithOverlap>();
|
||||
|
@ -41,13 +39,11 @@ CNodePtr GetRealPrevCNode(const AnfNodePtr &node) {
|
|||
return nullptr;
|
||||
}
|
||||
auto cnode = node->cast<CNodePtr>();
|
||||
|
||||
if (IsRealCNodeKernel(cnode)) {
|
||||
return cnode;
|
||||
}
|
||||
|
||||
auto input0 = cnode->input(0);
|
||||
|
||||
if (IsPrimitive(input0, prim::kPrimMakeTuple)) {
|
||||
auto temp_node = cnode->input(1);
|
||||
if (temp_node == nullptr) {
|
||||
|
@ -81,7 +77,6 @@ void ConcatSplitEliminate(const FuncGraphPtr &func_graph, const CNodePtr &cnode)
|
|||
int pre_inputs_node_size = pre_inputs_size - 1;
|
||||
auto pre_prim = GetValueNode<std::shared_ptr<ops::Concat>>(pre_cnode->input(kAnfPrimitiveIndex));
|
||||
auto prim = GetValueNode<std::shared_ptr<ops::SplitWithOverlap>>(cnode->input(kAnfPrimitiveIndex));
|
||||
|
||||
if (prim->get_number_split() != pre_inputs_node_size) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,6 @@ std::vector<int64_t> GetSplitPadList(const std::shared_ptr<ops::Conv2DFusion> &o
|
|||
}
|
||||
|
||||
namespace {
|
||||
|
||||
bool CalSplitOutputShape(int64_t splited_axis_value, const SplitInfo *split_info,
|
||||
std::vector<int64_t> *split_axis_out_shape,
|
||||
std::vector<int64_t> *split_axis_reduce_out_shape) {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
namespace mindspore {
|
||||
namespace opt {
|
||||
|
||||
AnfNodePtr IterNodeOutputs::Run(const FuncGraphPtr &func_graph, const AnfNodePtr &node) {
|
||||
if (CheckIfFuncGraphIsNull(func_graph) != lite::RET_OK || CheckIfAnfNodeIsNull(node) != lite::RET_OK) {
|
||||
return nullptr;
|
||||
|
@ -41,6 +40,5 @@ AnfNodePtr IterNodeOutputs::Run(const FuncGraphPtr &func_graph, const AnfNodePtr
|
|||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace opt
|
||||
} // namespace mindspore
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
namespace mindspore {
|
||||
namespace opt {
|
||||
|
||||
AnfNodePtr NodeOutShapes::Run(const FuncGraphPtr &func_graph, const AnfNodePtr &node) {
|
||||
if (CheckIfFuncGraphIsNull(func_graph) != lite::RET_OK || CheckIfAnfNodeIsNull(node) != lite::RET_OK) {
|
||||
return nullptr;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "ops/affine.h"
|
||||
|
||||
namespace mindspore::opt {
|
||||
|
||||
static bool IsAffineNode(const BaseRef &n) {
|
||||
if (utils::isa<AnfNodePtr>(n)) {
|
||||
auto anf_node = utils::cast<AnfNodePtr>(n);
|
||||
|
|
|
@ -25,8 +25,9 @@
|
|||
#include "tools/optimizer/common/gllo_utils.h"
|
||||
|
||||
namespace mindspore::opt {
|
||||
|
||||
constexpr auto kRowAxis = 1;
|
||||
constexpr auto kInputWithBiasNum = 4;
|
||||
constexpr auto kInputBias = 3;
|
||||
|
||||
static bool IsSpliceNode(const BaseRef &n) {
|
||||
if (utils::isa<AnfNodePtr>(n)) {
|
||||
|
@ -108,8 +109,8 @@ const AnfNodePtr AffineFusion::Process(const FuncGraphPtr &func_graph, const Anf
|
|||
}
|
||||
// construct affine node
|
||||
std::vector<AnfNodePtr> affine_inputs = {NewValueNode(affine_prim), splice_node->input(1), matmul_node->input(2)};
|
||||
if (matmul_node->inputs().size() == 4) {
|
||||
affine_inputs.push_back(matmul_node->input(3));
|
||||
if (matmul_node->inputs().size() == kInputWithBiasNum) {
|
||||
affine_inputs.push_back(matmul_node->input(kInputBias));
|
||||
}
|
||||
auto affine_node = func_graph->NewCNode(affine_inputs);
|
||||
affine_node->set_fullname_with_scope(matmul_node->fullname_with_scope());
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "tools/converter/ops/ops_def.h"
|
||||
|
||||
namespace mindspore::opt {
|
||||
|
||||
constexpr auto kDefaultIndex = 0;
|
||||
constexpr auto kInputIndex = 1;
|
||||
constexpr auto kDefaultNumTensors = 1;
|
||||
|
@ -188,5 +187,4 @@ const AnfNodePtr AddTensorArray::Process(const FuncGraphPtr &func_graph, const A
|
|||
|
||||
return node;
|
||||
}
|
||||
|
||||
} // namespace mindspore::opt
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
using mindspore::schema::PrimitiveType_Conv2DFusion;
|
||||
namespace mindspore {
|
||||
namespace opt {
|
||||
|
||||
int Conv2DInfo::CheckStrategy(const SplitStrategy &strategy) {
|
||||
int split_count = 0;
|
||||
Strategys strategys = strategy.strategys;
|
||||
|
|
|
@ -195,6 +195,5 @@ int OperatorInfo::DoSplit() {
|
|||
}
|
||||
return lite::RET_OK;
|
||||
}
|
||||
|
||||
} // namespace opt
|
||||
} // namespace mindspore
|
||||
|
|
|
@ -133,6 +133,5 @@ AnfNodePtr ParallelPass::Run(const FuncGraphPtr &func_graph, const AnfNodePtr &n
|
|||
}
|
||||
return parallel_operator->replace_op();
|
||||
}
|
||||
|
||||
} // namespace opt
|
||||
} // namespace mindspore
|
||||
|
|
Loading…
Reference in New Issue