diff --git a/torchvision/csrc/io/image/cpu/decode_webp.cpp b/torchvision/csrc/io/image/cpu/decode_webp.cpp index 0a9ff9ddbce..b202473c039 100644 --- a/torchvision/csrc/io/image/cpu/decode_webp.cpp +++ b/torchvision/csrc/io/image/cpu/decode_webp.cpp @@ -44,12 +44,10 @@ torch::Tensor decode_webp( auto decoded_data = decoding_func(encoded_data_p, encoded_data_size, &width, &height); - TORCH_CHECK(decoded_data != nullptr, "WebPDecodeRGB[A] failed."); - auto deleter = [decoded_data](void*) { WebPFree(decoded_data); }; auto out = torch::from_blob( - decoded_data, {height, width, num_channels}, deleter, torch::kUInt8); + decoded_data, {height, width, num_channels}, torch::kUInt8); return out.permute({2, 0, 1}); }