Browse Source

!14145 support negative index

From: @youui
Reviewed-by: @zh_qh,@kisnwang
Signed-off-by: @zh_qh
pull/14145/MERGE
mindspore-ci-bot Gitee 4 years ago
parent
commit
f71699fbfd
2 changed files with 14 additions and 11 deletions
  1. +13
    -11
      mindspore/ccsrc/pipeline/jit/pass.cc
  2. +1
    -0
      mindspore/ops/composite/multitype_ops/getitem_impl.py

+ 13
- 11
mindspore/ccsrc/pipeline/jit/pass.cc View File

@@ -154,17 +154,19 @@ OptPassGroupMap GetOptPassesA(const opt::irpass::OptimizeIRPassLib &irpass) {
opt::OptPassConfig a_after_grad = opt::OptPassConfig({
irpass.inline_without_move_,
});
opt::OptPassConfig a_3 = opt::OptPassConfig({
irpass.arithmetic_simplify2_,
irpass.same_eliminate_,
irpass.check_bprop_eliminate_,
irpass.switch_layer_defer_inline_,
irpass.replace_applicator_,
irpass.mirror_mini_step_elim_,
irpass.virtual_add_elim_,
irpass.row_tensor_add_zeros_like_,
irpass.mini_step_allgather_replace_,
});
opt::OptPassConfig a_3 = opt::OptPassConfig(
{
irpass.arithmetic_simplify2_,
irpass.same_eliminate_,
irpass.check_bprop_eliminate_,
irpass.switch_layer_defer_inline_,
irpass.replace_applicator_,
irpass.mirror_mini_step_elim_,
irpass.virtual_add_elim_,
irpass.row_tensor_add_zeros_like_,
irpass.mini_step_allgather_replace_,
},
false, true);
opt::OptPassConfig virtual_dataset = opt::OptPassConfig({irpass.virtual_dataset_eliminate_});
opt::irpass::ResolveIRPassLib resolve_irpass;



+ 1
- 0
mindspore/ops/composite/multitype_ops/getitem_impl.py View File

@@ -113,6 +113,7 @@ def _tuple_getitem_by_tensor(data, tensor_index):
Outputs:
Type, is the same as the element type of data.
"""
tensor_index = F.select(tensor_index >= 0, tensor_index, tensor_index + len(data))
return _tuple_get_item_tensor(data, tensor_index)




Loading…
Cancel
Save