Commit 60ea36a5 authored by wanghailong's avatar wanghailong

补全assert注释

parent 4a1866b3
......@@ -23,7 +23,10 @@ namespace nvinfer1
}
Chunk::Chunk(const void* buffer, size_t size)
{
assert(size == sizeof(_n_size_split));
//assert(size == sizeof(_n_size_split));
if(size != sizeof(_n_size_split)){
printf("size error!");
}
_n_size_split = *reinterpret_cast<const int*>(buffer);
}
Chunk::~Chunk()
......@@ -37,8 +40,11 @@ namespace nvinfer1
Dims Chunk::getOutputDimensions(int index, const Dims* inputs, int nbInputDims)
{
assert(nbInputDims == 1);
assert(index == 0 || index == 1);
//assert(nbInputDims == 1);
//assert(index == 0 || index == 1);
if(nbInputDims != 1 || index != 0 || index != 1){
printf("output size error!");
}
return Dims3(inputs[0].d[0] / 2, inputs[0].d[1], inputs[0].d[2]);
}
......@@ -111,7 +117,10 @@ namespace nvinfer1
const nvinfer1::DataType* inputTypes,
int nbInputs) const
{
assert(index == 0 || index == 1);
//assert(index == 0 || index == 1);
if(index == 0 || index == 1){
printf("get type error");
}
return DataType::kFLOAT;
}
......
......@@ -34,8 +34,8 @@ namespace nvinfer1
read(d,_n_grid_h);
read(d, _n_grid_w);
read(d, _n_output_size);
//printf("anchor:%d,classes:%d,gh:%d,gw:%d,size:%d\n", _n_anchor, _n_classes, _n_grid_h, _n_grid_w, _n_output_size);
assert(d == a + length);
printf("anchor:%d,classes:%d,gh:%d,gw:%d,size:%d\n", _n_anchor, _n_classes, _n_grid_h, _n_grid_w, _n_output_size);
//assert(d == a + length);
}
Detect::Detect(const uint32_t n_anchor_, const uint32_t n_classes_,
......@@ -143,7 +143,7 @@ namespace nvinfer1
write(d, _n_grid_h);
write(d, _n_grid_w);
write(d, _n_output_size);
assert(d == a + getSerializationSize());
//assert(d == a + getSerializationSize());
}
void Detect::configurePlugin(const PluginTensorDesc* in, int nbInput, const PluginTensorDesc* out, int nbOutput)
......
......@@ -35,8 +35,8 @@ namespace nvinfer1
const char *d = reinterpret_cast<const char*>(data), *a = d;
r(d, _n_max_thread_pre_block);
r(d, _n_output_size);
// printf("r:threads:%d,size:%d\n", _n_max_thread_pre_block, _n_output_size);
assert(d == a + length);
printf("r:threads:%d,size:%d\n", _n_max_thread_pre_block, _n_output_size);
//assert(d == a + length);
}
Hardswish::~Hardswish()
......@@ -94,8 +94,8 @@ namespace nvinfer1
char *d = static_cast<char*>(buffer), *a = d;
w(d, _n_max_thread_pre_block);
w(d, _n_output_size);
// printf("serialize:%d,%d\n", _n_max_thread_pre_block, _n_output_size);
assert(d == a + getSerializationSize());
printf("serialize:%d,%d\n", _n_max_thread_pre_block, _n_output_size);
//assert(d == a + getSerializationSize());
}
void Hardswish::configurePlugin(const PluginTensorDesc* in, int nbInput, const PluginTensorDesc* out, int nbOutput)
......
......@@ -319,7 +319,7 @@ public:
static void reportTestStart(TestAtom& testAtom)
{
reportTestResult(testAtom, TestResult::kRUNNING);
assert(!testAtom.mStarted);
//assert(!testAtom.mStarted);
testAtom.mStarted = true;
}
......@@ -334,8 +334,8 @@ public:
//!
static void reportTestEnd(const TestAtom& testAtom, TestResult result)
{
assert(result != TestResult::kRUNNING);
assert(testAtom.mStarted);
//assert(result != TestResult::kRUNNING);
//assert(testAtom.mStarted);
reportTestResult(testAtom, result);
}
......
......@@ -17,7 +17,7 @@ namespace nvinfer1
// create the plugin at runtime from a byte stream
MishPlugin::MishPlugin(const void* data, size_t length)
{
assert(length == sizeof(input_size_));
//assert(length == sizeof(input_size_));
input_size_ = *reinterpret_cast<const int*>(data);
}
......@@ -38,8 +38,8 @@ namespace nvinfer1
Dims MishPlugin::getOutputDimensions(int index, const Dims* inputs, int nbInputDims)
{
assert(nbInputDims == 1);
assert(index == 0);
//assert(nbInputDims == 1);
//assert(index == 0);
input_size_ = inputs[0].d[0] * inputs[0].d[1] * inputs[0].d[2];
// Output dimensions
return Dims3(inputs[0].d[0], inputs[0].d[1], inputs[0].d[2]);
......
......@@ -398,7 +398,7 @@ std::vector<float> loadWeights(const std::string weightsFilePath, const std::str
while (!file.eof())
{
file.read(floatWeight, 4);
assert(file.gcount() == 4);
//assert(file.gcount() == 4);
weights.push_back(*reinterpret_cast<float*>(floatWeight));
if (file.peek() == std::istream::traits_type::eof()) break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment