List striding with arbitrary step size (#58537)

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/58537

Test Plan: Imported from OSS

Reviewed By: ejguan

Differential Revision: D28531721

Pulled By: tugsbayasgalan

fbshipit-source-id: 8c8ed32ca00366603bfb5086e87dfa62736ff4b2
This commit is contained in:
Tugsbayasgalan (Tugsuu) Manlaibaatar
2021-06-22 11:20:59 -07:00
committed by Facebook GitHub Bot
parent df8a8fbc1b
commit fca931d181
14 changed files with 249 additions and 58 deletions

View File

@ -95,9 +95,9 @@ std::shared_ptr<Graph> build_lstm() {
std::shared_ptr<Graph> build_mobile_export_analysis_graph() {
// We use following two schemas for this graph:
// 1. slice.Tensor(Tensor(a) self, int dim=0, int? start=0,
// int? end=9223372036854775807, int step=1) -> Tensor(a)
// 2. slice.str(str string, int? start=0, int? end=9223372036854775807,
// 1. slice.Tensor(Tensor(a) self, int dim=0, int? start=None,
// int? end=None, int step=1) -> Tensor(a)
// 2. slice.str(str string, int? start=None, int? end=None,
// int step=1) -> str
// %3 and %4 use slice.Tensor while %5 use slice.str.
// Since we can see %3 and %4 have the same last argument that is never used
@ -114,7 +114,7 @@ std::shared_ptr<Graph> build_mobile_export_analysis_graph() {
%22 : str = prim::Constant[value="value"]()
%3 : Tensor = aten::slice(%0, %1, %20, %2, %1)
%4 : Tensor = aten::slice(%0, %2, %20, %21, %1)
%5 : str = aten::slice(%22, %20, %21, %1)
%5 : str = aten::slice(%22, %20, %21, %2)
return (%3, %4, %5))IR";
auto g = std::make_shared<Graph>();
@ -139,7 +139,7 @@ std::shared_ptr<Graph> build_mobile_export_analysis_graph_nested() {
%c : Tensor = prim::If(%23)
block0():
%4 : Tensor = aten::slice(%0, %2, %20, %21, %1)
%5 : str = aten::slice(%22, %20, %21, %1)
%5 : str = aten::slice(%22, %20, %21, %2)
%c.1 : Tensor = aten::slice(%0, %1, %20, %2, %1)
-> (%c.1)
block1():