Skip to content

Commit

Permalink
feat(torch): support detection models in chains
Browse files Browse the repository at this point in the history
torch models where only supported at the end of the chain, this adds support for an image model whose outputs go to another model
  • Loading branch information
Bycob authored and mergify[bot] committed Jun 7, 2021
1 parent d8439d4 commit 7bb9705
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/backends/torch/torchlib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1550,6 +1550,22 @@ namespace dd
unsupo.finalize(output_params, out,
static_cast<MLModel *>(&this->_mlmodel));
}

if (ad.has("chain") && ad.get("chain").get<bool>())
{
if (typeid(inputc) == typeid(ImgTorchInputFileConn))
{
auto *img_ic = reinterpret_cast<ImgTorchInputFileConn *>(&inputc);
APIData chain_input;
if (!img_ic->_orig_images.empty())
chain_input.add("imgs", img_ic->_orig_images);
else
chain_input.add("imgs", img_ic->_images);
chain_input.add("imgs_size", img_ic->_images_size);
out.add("input", chain_input);
}
}

out.add("status", 0);
return 0;
}
Expand Down

0 comments on commit 7bb9705

Please sign in to comment.