采用onnx-tensorrt项目,解析onnx的模型时,报错:

terminate called after throwing an instance of ‘std::bad_alloc’
what(): std::bad_alloc

原因:
插件的 serialize 函数写错了
正确的写法

void serialize(void* buffer) const override {
        serializeBase(buffer);
        serialize_value(&buffer, _channel);
        serialize_value(&buffer, _alpha);
    }

错误的写法

void serialize(void* buffer) const override {
        serializeBase(buffer);
        serialize_value(&buffer, &_channel);
        serialize_value(&buffer, &_alpha);
    }