10000 [caffe2] Remove OperatorBase::newstyle_outputs_ by peterbell10 · Pull Request #67093 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[caffe2] Remove OperatorBase::newstyle_outputs_ #67093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 22 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
de0edc0
[caffe2] Remove Operator::newstyle_outputs_
peterbell10 Oct 22, 2021
7bff0a1
Update on "[caffe2] Remove Operator::newstyle_outputs_"
peterbell10 Oct 22, 2021
52608de
Update on "[caffe2] Remove Operator::newstyle_outputs_"
peterbell10 Oct 22, 2021
a2bd24e
Update on "[caffe2] Remove Operator::newstyle_outputs_"
peterbell10 Oct 22, 2021
7d7f99f
Update on "[caffe2] Remove OperatorBase::newstyle_outputs_"
peterbell10 Oct 24, 2021
f3ad7c3
Update on "[caffe2] Remove OperatorBase::newstyle_outputs_"
peterbell10 Oct 28, 2021
ae55e45
Update on "[caffe2] Remove OperatorBase::newstyle_outputs_"
peterbell10 Nov 17, 2021
dd3ec09
Update on "[caffe2] Remove OperatorBase::newstyle_outputs_"
peterbell10 Dec 6, 2021
1d690ec
Update on "[caffe2] Remove OperatorBase::newstyle_outputs_"
peterbell10 Jan 3, 2022
fa6a3f6
Update on "[caffe2] Remove OperatorBase::newstyle_outputs_"
peterbell10 Jan 14, 2022
e65e6f3
Update on "[caffe2] Remove OperatorBase::newstyle_outputs_"
peterbell10 Jan 17, 2022
018f0a3
Update on "[caffe2] Remove OperatorBase::newstyle_outputs_"
peterbell10 Jan 18, 2022
8d90b65
Update on "[caffe2] Remove OperatorBase::newstyle_outputs_"
peterbell10 Jan 20, 2022
881db53
Update on "[caffe2] Remove OperatorBase::newstyle_outputs_"
peterbell10 Jan 21, 2022
f66e024
Rebase after master CI break on "[caffe2] Remove OperatorBase::newsty…
peterbell10 Jan 22, 2022
10000
f830c30
Only build IValueInterface when necessary on "[caffe2] Remove Operato…
peterbell10 Feb 14, 2022
2e67734
Rebase and fix merge conflicts on "[caffe2] Remove OperatorBase::news…
peterbell10 Mar 29, 2022
f50c7ca
Rebase on "[caffe2] Remove OperatorBase::newstyle_outputs_"
peterbell10 Apr 8, 2022
b8ae3ac
Update on "[caffe2] Remove OperatorBase::newstyle_outputs_"
peterbell10 Jul 27, 2022
4723019
Rebase on "[caffe2] Remove OperatorBase::newstyle_outputs_"
peterbell10 Oct 10, 2022
3d950c5
Update on "[caffe2] Remove OperatorBase::newstyle_outputs_"
peterbell10 Nov 14, 2022
60eb729
Update on "[caffe2] Remove OperatorBase::newstyle_outputs_"
peterbell10 Jan 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update on "[caffe2] Remove OperatorBase::newstyle_outputs_"
`OperatorBase` maintains `output_tensors_` and `newstyle_outputs_`
which hold the same list of tensors except one is
`vector<caffe2::Tensor>` and the other is `List<at::Tensor>`.

This instead maintains only `output_tensors_` and handles the
conversions inside of export_caffe2_op_to_c10.

Differential Revision: [D32289811](https://our.internmc.facebook.com/intern/diff/D32289811)

[ghstack-poisoned]
  • Loading branch information
peterbell10 committed Jan 18, 2022
commit 018f0a3980a8c272d2115f9f0d965fc7290a1f22
5 changes: 2 additions & 3 deletions caffe2/core/export_caffe2_op_to_c10.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ inline void _call_caffe2_op_from_c10(
*OptionalType::create(ListType::ofTensors())));
IValue preallocated_outputs = torch::jit::pop(*stack);

const size_t num_outputs = schema.returns().size();
const size_t num_inputs = schema.arguments().size() -
1; // -1 because the last argument is the list of preallocated tensors

Expand All @@ -71,18 +70,18 @@ inline void _call_caffe2_op_from_c10(
// either the schema doesn't support preallocated outputs or it does but
// they haven't been passed in. Pass a list of uninitialized tensors to
// the caffe2 operator as preallocated outputs.
outputs.resize(num_outputs);
outputs.resize(schema.returns().size());
} else {
AT_ASSERT(preallocated_outputs.isTensorList());
outputs = std::move(preallocated_outputs).toTensorList();
TORCH_INTERNAL_ASSERT(num_outputs == outputs.size());
}

// TODO Avoid vector allocation. One idea would be to keep the std::vector
// instances in the cache.
std::vector<IValue> inputs = torch::jit::pop(*stack, num_inputs);

// Convert outputs to caffe2::Tensor
const size_t num_outputs = outputs.size();
std::vector<caffe2::Tensor> outputs_c2(num_outputs);
for (auto i : c10::irange(num_outputs)) {
outputs_c2[i] = caffe2::Tensor(outputs.extract(i));
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
0