[ME][Fallback] Handle interpret nodes in list.

This commit is contained in:
Margaret_wangrui 2021-12-06 16:58:21 +08:00
parent 97128247d5
commit fa8506c0a7
2 changed files with 16 additions and 0 deletions

View File

@ -1038,6 +1038,7 @@ AnfNodePtr Parser::ParseList(const FunctionBlockPtr &block, const py::object &no
list_vec.emplace_back(make_list_op);
for (size_t i = 0; i < elts.size(); i++) {
AnfNodePtr node_ptr = ParseExprNode(block, elts[i]);
node_ptr = HandleInterpret(block, node_ptr, elts[i]);
list_vec.emplace_back(node_ptr);
}
CNodePtr list_app = block->func_graph()->NewCNodeInOrder(std::move(list_vec));

View File

@ -84,6 +84,21 @@ def test_tuple_of_tensor():
print(use_tuple_of_tensor())
@ms_function
def use_list_of_tensor():
me_x = [Tensor(1), Tensor(1)]
return me_x
def test_list_of_tensor():
"""
Feature: JIT Fallback
Description: Test list of tensor in graph mode.
Expectation: No exception.
"""
print(use_list_of_tensor())
class Net(nn.Cell):
def __init__(self):
super(Net, self).__init__()