Skip to content

[DUPLICATE] Fix for NGC 25.02 #3368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions core/conversion/converters/impl/batch_norm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,15 @@ auto batch_norm_registrations TORCHTRT_UNUSED =

auto eps = static_cast<float>(args[7].unwrapToDouble(1e-5f));

auto scales = args[1].unwrapToTensor(at::ones(shape[1], options)).cpu().contiguous();
auto bias = args[2].unwrapToTensor(at::zeros(shape[1], options)).cpu().contiguous();

auto scales = at::ones(shape[1], options);
if (!args[1].IValue()->isNone()) {
scales = args[1].unwrapToTensor(at::ones(shape[1], options)).cpu().contiguous();
}
auto bias = at::zeros(shape[1], options);
if (!args[2].IValue()->isNone()){
bias = args[2].unwrapToTensor(at::zeros(shape[1], options)).cpu().contiguous();
}
// track_running_stats=True
if (!args[3].IValue()->isNone() || !args[4].IValue()->isNone()) {
auto running_mean = args[3].unwrapToTensor();
Expand All @@ -154,6 +160,8 @@ auto batch_norm_registrations TORCHTRT_UNUSED =
return true;
}

// Not sure this actually does something since the cudnn_enabled is from the PyTorch context.
// We need cuDNN either way to run this converter
auto cudnn_enabled = static_cast<bool>(args[8].unwrapToBool(false));
if (!cudnn_enabled) {
LOG_DEBUG(
Expand All @@ -162,7 +170,7 @@ auto batch_norm_registrations TORCHTRT_UNUSED =
so for some functionalities, users need to install correct \
cuDNN version by themselves. Please see our support matrix \
here: https://docs.nvidia.com/deeplearning/tensorrt/support-matrix/index.html.");
return false;
//return false;
}

const int relu = 0;
Expand Down
1 change: 1 addition & 0 deletions core/util/prelude.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// A collection of headers from util that will typically get included in most
// files
#include <cstdint>
#include "core/util/Exception.h"
#include "core/util/build_info.h"
#include "core/util/jit_util.h"
Expand Down
2 changes: 1 addition & 1 deletion tests/core/conversion/converters/test_instance_norm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ constexpr auto graph = R"IR(
%running_mean.1 : Tensor?,
%running_var.1 : Tensor?,
%use_input_stats.1 : bool):
%cudnn_enabled.1 : bool = prim::Constant[value=0]()
%cudnn_enabled.1 : bool = prim::Constant[value=1]()
%momentum.1 : float = prim::Constant[value=0.10000000000000001]()
%eps.1 : float = prim::Constant[value=1.0000000000000001e-05]()
%4 : Tensor = aten::instance_norm(%input.1,
Expand Down
Loading