Skip to content

Commit

Permalink
fix: prevent softmax after layer extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
beniz authored and mergify[bot] committed Feb 4, 2021
1 parent c5f7303 commit cbee659
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/backends/torch/torchlib.cc
Expand Up @@ -1069,7 +1069,7 @@ namespace dd
}
output = torch::stack(outputs);
}
if (_classification)
if (extract_layer.empty() && _classification)
output = torch::softmax(output, 1).to(cpu);
else
output = output.to(cpu);
Expand Down Expand Up @@ -1106,7 +1106,7 @@ namespace dd

double *startout = fo.data_ptr<double>();
std::vector<double> vals(startout,
startout + torch ::numel(fo));
startout + torch::numel(fo));

rad.add("vals", vals);
results_ads.push_back(rad);
Expand Down

0 comments on commit cbee659

Please sign in to comment.