Skip to content
Snippets Groups Projects
Commit c335e9ab authored by Franck Dary's avatar Franck Dary
Browse files

Corrected bug in ContextualModule

parent a88641ae
Branches
No related tags found
No related merge requests found
...@@ -173,13 +173,17 @@ void ContextualModuleImpl::addToContext(std::vector<std::vector<long>> & context ...@@ -173,13 +173,17 @@ void ContextualModuleImpl::addToContext(std::vector<std::vector<long>> & context
for (auto index : targetIndexes) for (auto index : targetIndexes)
{ {
if (configIndex2ContextIndex.count(index)) if (configIndex2ContextIndex.count(index))
{
for (auto & contextElement : context) for (auto & contextElement : context)
contextElement.push_back(configIndex2ContextIndex.at(index)+1); contextElement.push_back(configIndex2ContextIndex.at(index));
}
else else
{
for (auto & contextElement : context) for (auto & contextElement : context)
contextElement.push_back(0); contextElement.push_back(0);
} }
} }
}
torch::Tensor batchedIndexSelect(torch::Tensor input, int dim, torch::Tensor index) torch::Tensor batchedIndexSelect(torch::Tensor input, int dim, torch::Tensor index)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment