Skip to content

Testdata for PR #17978#793

Merged
alalek merged 6 commits intoopencv:3.4from
sl-sergei:testdata_for_17516_17531
Aug 26, 2020
Merged

Testdata for PR #17978#793
alalek merged 6 commits intoopencv:3.4from
sl-sergei:testdata_for_17516_17531

Conversation

@sl-sergei
Copy link
Copy Markdown
Contributor

Data for PR opencv/opencv#17978

@alalek
Copy link
Copy Markdown
Member

alalek commented Aug 14, 2020

Please rebase commit to resolve conflicts.

Comment on lines +909 to +929
class MatmulWithTwoInputs(nn.Module):
def __init__(self, in_dim = 2, const_dim=2, interm_dim = 2):
super(MatmulWithTwoInputs, self).__init__()
self.in_dim = in_dim
self.const_dim = const_dim
self.interm_dim = interm_dim
self.linear_for_const = nn.Linear(const_dim, interm_dim)
self.first_linear = nn.Linear(in_dim, interm_dim)
self.second_linear = nn.Linear(interm_dim, 1)
def forward(self, x):
x = x.reshape(-1, self.in_dim)
x_projected = self.first_linear(x)
const = torch.zeros(1, self.interm_dim)
const_projected = self.linear_for_const(const)
const_projected = const_projected.expand(2, self.interm_dim)
sum_tanh = torch.tanh(const_projected + x_projected)
sum_tanh = sum_tanh.reshape(-1, self.interm_dim)
sum_tanh_projected = self.second_linear(sum_tanh)
sum_tanh_projected = sum_tanh_projected.reshape(1, 2)
after_softmax = F.softmax(sum_tanh_projected, dim=1)
return torch.matmul(after_softmax, x)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we really need such a large subgraph? Maybe you can cover your changes in the onnx importer using just one matrix multiplication?

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.

Unfortunately, it does not reproduce that way

@sl-sergei sl-sergei force-pushed the testdata_for_17516_17531 branch from b6e40af to e71619b Compare August 26, 2020 06:19
@alalek alalek merged commit e4f9106 into opencv:3.4 Aug 26, 2020
@alalek
Copy link
Copy Markdown
Member

alalek commented Aug 26, 2020

Please do not use merge commits in PRs to resolve conflicts.
Use git rebase instead.

There are several artifacts during PR merge which requires extra changes:

* Add new testdata for Matmul and Expand operations

* remove artifacts and reduce data size

* Added testdata for ONNX Pow op

* Add regression data for NaN output with Andreff's Hand-Eye calibration method.

Co-authored-by: Liubov Batanina <piccione-mail@yandex.ru>
Co-authored-by: catree <catree.catreus@outlook.com>

@alalek alalek mentioned this pull request Aug 26, 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.

4 participants