-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(): added some fixes, trt/jit output still mismatches
Signed-off-by: Abhiram Iyer <[email protected]> Signed-off-by: Abhiram Iyer <[email protected]>
- Loading branch information
1 parent
d7c3164
commit 723ac1d
Showing
5 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <torch/csrc/jit/passes/subgraph_rewrite.h> | ||
|
||
#include "core/util/prelude.h" | ||
|
||
namespace trtorch { | ||
namespace core { | ||
namespace lowering { | ||
namespace passes { | ||
|
||
void Conv3DToConvolution(std::shared_ptr<torch::jit::Graph>& graph) { | ||
std::string conv3d_pattern = R"IR( | ||
graph(%x, %w, %b, %s, %p, %d, %g): | ||
%4 : Tensor = aten::conv3d(%x, %w, %b, %s, %p, %d, %g) | ||
return (%4))IR"; | ||
std::string convolution_pattern = R"IR( | ||
graph(%x, %w, %b, %s, %p, %d, %g): | ||
%1 : bool = prim::Constant[value=0]() | ||
%2 : int[] = prim::Constant[value=[0, 0]]() | ||
%4 : Tensor = aten::_convolution(%x, %w, %b, %s, %p, %d, %1, %2, %g, %1, %1, %1) | ||
return (%4))IR";; | ||
|
||
// replace matmul + add pattern to linear | ||
torch::jit::SubgraphRewriter map_conv3d_to_convolution; | ||
map_conv3d_to_convolution.RegisterRewritePattern( | ||
conv3d_pattern, convolution_pattern); | ||
map_conv3d_to_convolution.runOnGraph(graph); | ||
LOG_GRAPH("Post map conv3d -> _convolution: " << *graph); | ||
} | ||
|
||
} // namespace passes | ||
} // namespace lowering | ||
} // namespace core | ||
} // namespace trtorch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters