Skip to content

Commit e98a7e0

Browse files
tarun292facebook-github-bot
authored andcommitted
Access last element of vector for current input details (#2393)
Summary: Pull Request resolved: #2393 In pybindings when iterating on the inputs, preparing them for execution we were using the index `i` to access sizes, dim_order, strides etc. of the current tensor being iterated on. This worked previously because all our inputs were all always tensors. In the seamless model we ran into a case where the inputs are a mixed tuple of tensors and constants (int's). In this case index `i` is not accurate anymore when accessing `input_tensors` to get the current tensor being operated on because we haven't pushed `i` number of tensors into the `input_tensors` vector as some of the inputs till now were non-tensors. Reviewed By: iseeyuan Differential Revision: D54836802 fbshipit-source-id: 07a2c2bd11087db058becad058c97ea3af305b85
1 parent 57237cd commit e98a7e0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

extension/pybindings/pybindings.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -461,13 +461,13 @@ struct PyModule final {
461461
input_tensors.emplace_back(
462462
type,
463463
dim,
464-
input_sizes[i].data(),
464+
input_sizes.back().data(),
465465
nullptr,
466-
input_dim_order[i].data(),
467-
input_strides[i].data());
466+
input_dim_order.back().data(),
467+
input_strides.back().data());
468468

469469
torch::executor::Tensor temp =
470-
torch::executor::Tensor(&input_tensors[i]);
470+
torch::executor::Tensor(&input_tensors.back());
471471
torch::util::alias_etensor_to_attensor(at_tensor, temp);
472472
EValue evalue(temp);
473473
#endif

0 commit comments

Comments
 (0)