Skip to content

Added test for fix in Split layer#701

Merged
alalek merged 5 commits intoopencv:3.4from
czgdp1807:issue-16370
Feb 15, 2020
Merged

Added test for fix in Split layer#701
alalek merged 5 commits intoopencv:3.4from
czgdp1807:issue-16370

Conversation

@czgdp1807
Copy link
Copy Markdown
Contributor

See, opencv/opencv#16424 (comment)

ping @dkurt Please take a look. Please let me know if there is any change to make.

@czgdp1807 czgdp1807 mentioned this pull request Jan 27, 2020
2 tasks
save_data_and_model("split_2", input, model)

model = Split(0)
save_data_and_model("split_3", input, model)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between split_1 and split_3 cases?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to tests how the model will be processed by ONNXImporter in case no attribute is given to Split in split_1. In split_3, I am trying to test the case when only axis is given. I think one more case is left, when only split is given. I will add that too.

@czgdp1807
Copy link
Copy Markdown
Contributor Author

Update:
Hi,
I will be having my mid semester examinations till 7th February(IST). So the work on this may get slowed down. Please do not close this PR until then. I am on it and I will put efforts to complete it from 7th Feb. Thank you and apologies.

Comment on lines +437 to +439
def forward(self, x):
tup = torch.split(x, self.split_size_sections, self.dim)
return torch.cat(tup)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have used this because, usually, torch.split returns a python tuple which if converted to a tensor here will render the code useless as the layer will be saved as Constant and not Split.
And we cannot save python tuple in npy file as they are not produced correctly in the cpp tests and moreover they will require a lot of changes across some files to make tuples work in the code. Hence, this trick tests the Split layer with minimal changes in the code. Though I am open to suggestions on improving this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have run the tests locally they, pass on my system.

@czgdp1807
Copy link
Copy Markdown
Contributor Author

The tests passed. Is it good to go?

@alalek alalek merged commit 191e716 into opencv:3.4 Feb 15, 2020
@alalek alalek mentioned this pull request Feb 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants