未验证 提交 1d0917c8 编写于 作者: N nihui 提交者: GitHub

fix build with very old gcc (#4048)

* clear bom marker, avoid vector data function
上级 e64245c4
// Tencent is pleased to support the open source community by making ncnn available.
// Tencent is pleased to support the open source community by making ncnn available.
//
// Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
//
......
......@@ -832,7 +832,7 @@ public:
bottom_blobs0[i] = (ncnn_mat_t)&bottom_blobs[i];
}
std::vector<ncnn_mat_t> top_blobs0(n2, (ncnn_mat_t)0);
int ret = layer->forward_n(layer, bottom_blobs0.data(), n, top_blobs0.data(), n2, (ncnn_option_t)&opt);
int ret = layer->forward_n(layer, &bottom_blobs0[0], n, &top_blobs0[0], n2, (ncnn_option_t)&opt);
for (int i = 0; i < n2; i++)
{
top_blobs[i] = *(Mat*)top_blobs0[i];
......@@ -858,7 +858,7 @@ public:
{
bottom_top_blobs0[i] = (ncnn_mat_t)&bottom_top_blobs[i];
}
return layer->forward_inplace_n(layer, bottom_top_blobs0.data(), n, (ncnn_option_t)&opt);
return layer->forward_inplace_n(layer, &bottom_top_blobs0[0], n, (ncnn_option_t)&opt);
}
virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const
......
// Tencent is pleased to support the open source community by making ncnn available.
// Tencent is pleased to support the open source community by making ncnn available.
//
// Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
//
......
// Tencent is pleased to support the open source community by making ncnn available.
// Tencent is pleased to support the open source community by making ncnn available.
//
// Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
//
......
// Tencent is pleased to support the open source community by making ncnn available.
// Tencent is pleased to support the open source community by making ncnn available.
//
// Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
//
......
......@@ -121,14 +121,14 @@ Mat ModelBinFromDataReader::load(int w, int type) const
{
std::vector<unsigned short> float16_weights;
float16_weights.resize(align_data_size);
nread = d->dr.read(float16_weights.data(), align_data_size);
nread = d->dr.read(&float16_weights[0], align_data_size);
if (nread != align_data_size)
{
NCNN_LOGE("ModelBin read float16_weights failed %zd", nread);
return Mat();
}
m = Mat::from_float16(float16_weights.data(), w);
m = Mat::from_float16(&float16_weights[0], w);
}
return m;
......@@ -149,7 +149,7 @@ Mat ModelBinFromDataReader::load(int w, int type) const
{
std::vector<signed char> int8_weights;
int8_weights.resize(align_data_size);
nread = d->dr.read(int8_weights.data(), align_data_size);
nread = d->dr.read(&int8_weights[0], align_data_size);
if (nread != align_data_size)
{
NCNN_LOGE("ModelBin read int8_weights failed %zd", nread);
......@@ -160,7 +160,7 @@ Mat ModelBinFromDataReader::load(int w, int type) const
if (m.empty())
return m;
memcpy(m.data, int8_weights.data(), w);
memcpy(m.data, &int8_weights[0], w);
}
return m;
......@@ -210,7 +210,7 @@ Mat ModelBinFromDataReader::load(int w, int type) const
size_t align_weight_data_size = alignSize(w * sizeof(unsigned char), 4);
std::vector<unsigned char> index_array;
index_array.resize(align_weight_data_size);
nread = d->dr.read(index_array.data(), align_weight_data_size);
nread = d->dr.read(&index_array[0], align_weight_data_size);
if (nread != align_weight_data_size)
{
NCNN_LOGE("ModelBin read index_array failed %zd", nread);
......
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<UIVisualizer ServiceId="{A452AFEA-3DF6-46BB-9177-C0B08F318025}" Id="1" MenuName="Add to Image Watch"/>
......
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<UIVisualizer ServiceId="{A452AFEA-3DF6-46BB-9177-C0B08F318025}" Id="1" MenuName="Add to Image Watch"/>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册