Skip to content
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

Added onnx export support for VectorWhitening #4577

Merged
merged 4 commits into from
Jan 23, 2020

Conversation

Lynx1820
Copy link
Contributor

No description provided.

@Lynx1820 Lynx1820 requested a review from a team as a code owner December 14, 2019 00:16
@codecov
Copy link

codecov bot commented Dec 14, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@fa75f4f). Click here to learn what that means.
The diff coverage is 97.01%.

@@            Coverage Diff            @@
##             master    #4577   +/-   ##
=========================================
  Coverage          ?   75.13%           
=========================================
  Files             ?      909           
  Lines             ?   160334           
  Branches          ?    17267           
=========================================
  Hits              ?   120466           
  Misses            ?    35050           
  Partials          ?     4818
Flag Coverage Δ
#Debug 75.13% <97.01%> (?)
#production 70.53% <95%> (?)
#test 90.3% <100%> (?)
Impacted Files Coverage Δ
test/Microsoft.ML.Tests/OnnxConversionTest.cs 95.66% <100%> (ø)
src/Microsoft.ML.Mkl.Components/VectorWhitening.cs 81.76% <95%> (ø)

if (rank != dimension)
{
float[] principalComponents = new float[rank * dimension];
for (int i = 0; i < parameters.Rank; i++)

Choose a reason for hiding this comment

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

for (int i = 0; i < parameters.Rank; i++) [](start = 20, length = 41)

If I understand correctly, this loop copies the first rank*dimension elements from model to principalComponents in the same order. Do we really need to copy?
I noticed that ctx.AddInitializer takes an IEnumerable, perhaps it would be enough to call it with model.Take(rank*dimension)?

Copy link
Contributor Author

@Lynx1820 Lynx1820 Dec 16, 2019

Choose a reason for hiding this comment

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

I think the problem with Take is that when the rank is higher than the dimension, ML.NET simply treats the extra eigenvectors as rows of zeros. For ONNX, the model tensor has to be resized. I can introduce a check for both ML.NET and ONNX to check that the rank <= dimension?

@Lynx1820
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@Lynx1820 Lynx1820 merged commit 2267f8d into dotnet:master Jan 23, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Mar 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants