fix gthread_num

pull/13837/head
z00512249 4 years ago
parent c66b4e4994
commit 684398e755

@ -36,7 +36,7 @@ void CodeWeightFileHeader(std::ofstream &ofs, const std::unique_ptr<CoderContext
" RET_ERROR = 1,\n"
"};\n\n";
// set a global var for thread_pool
ofs << "static int" << gThreadNum << " = 1;\n";
ofs << "extern int " << gThreadNum << ";\n";
}
void CodeModelParamsState(std::ofstream &ofs, const std::map<std::string, Tensor *> &weights) {

@ -134,7 +134,8 @@ int Generator::CodeWeightFile() {
MS_LOG(INFO) << "write " << cfile;
cofs << g_hwLicense;
cofs << "#include \"" << net_weight_hfile_ << "\"\n\n";
cofs << "unsigned char * " << ctx_->buffer_name() << " = 0 ; \n";
cofs << "int " << gThreadNum << " = 1;\n";
cofs << "unsigned char * " << ctx_->buffer_name() << " = 0;\n";
if (config_->target() != kARM32M) {
std::string net_file = net_src_file_path_ + "net.bin";

@ -29,15 +29,7 @@ using mindspore::schema::PrimitiveType_Unsqueeze;
namespace mindspore::lite::micro {
int ReshapeBaseCoder::Prepare(CoderContext *const context) {
bool is_next_conv = std::any_of(output_ops().begin(), output_ops().end(), [](OperatorCoder *next_op) {
return next_op->type() == schema::PrimitiveType_Conv2DFusion;
});
if (is_next_conv && output_tensor_->shape().size() == 4 && output_tensor_->format() == schema::Format::Format_NCHW) {
output_tensor_->set_format(schema::Format::Format_NHWC);
}
return RET_OK;
}
int ReshapeBaseCoder::Prepare(CoderContext *const context) { return RET_OK; }
int ReshapeBaseCoder::DoCode(CoderContext *const context) {
Serializer coder;

@ -62,7 +62,7 @@ int ConvolutionDepthwiseFP32Coder::DoCode(CoderContext *const context) {
MS_CHECK_TRUE(conv_param_->input_channel_ == conv_param_->output_channel_,
"Only support input channel equals output channel.");
// generate code .h .c
Collect(context, {"nnacl/fp32/conv_depthwise_fp32.h"}, {"conv_depthwise_fp32.c"});
Collect(context, {"nnacl/fp32/conv_depthwise_fp32.h"}, {"conv_depthwise_fp32.c"}, {"ConvDwFp32Row.S"});
nnacl::NNaclFp32Serializer code;
// call the op function

Loading…
Cancel
Save