fix instance norm double free (#1748)

pull/1753/head
q.yao 2023-02-13 19:42:37 +08:00 committed by GitHub
parent 31b099a37b
commit 0f5b149557
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 3 deletions

View File

@ -152,9 +152,18 @@ void TRTInstanceNormalization::attachToContext(cudnnContext* cudnnContext,
// Detach the plugin object from its execution context.
void TRTInstanceNormalization::detachFromContext() TRT_NOEXCEPT {
if (_y_desc) {
cudnnDestroyTensorDescriptor(_y_desc);
_y_desc = nullptr;
}
if (_x_desc) {
cudnnDestroyTensorDescriptor(_x_desc);
_x_desc = nullptr;
}
if (_b_desc) {
cudnnDestroyTensorDescriptor(_b_desc);
_b_desc = nullptr;
}
}
void TRTInstanceNormalization::configurePlugin(const nvinfer1::DynamicPluginTensorDesc* in,