Skip to content

Conversation

@yaeldekel
Copy link

When we create the editor, we lose the old values that were in the VBuffer in case it has to be resized.
Fixes #1756 .

Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka left a comment

Choose a reason for hiding this comment

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

:shipit:

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

Looks great. Thanks for investigating and fixing this mistake.


namespace Microsoft.ML.Core.Tests.UnitTests
{
public sealed class TestVBuffer
Copy link
Member

Choose a reason for hiding this comment

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

(Nit) I would name this class and file “TestVBufferUtils” instead, because that is what it is testing.

var buffer = new VBuffer<float>(10, 3, new[] { 0.5f, 1.2f, -3.8f }, new[] { 1, 5, 8 });
VBufferUtils.ApplyAt(ref buffer, 6, (int slot, ref float value) => { value = value + 1; });
Assert.Equal(4, buffer.GetValues().Length);
Assert.Equal(1, buffer.GetValues()[2]);
Copy link
Member

Choose a reason for hiding this comment

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

Can you verify all the values and indices are correct?

@yaeldekel yaeldekel merged commit 533e186 into dotnet:master Nov 28, 2018
@yaeldekel yaeldekel deleted the applyat branch November 28, 2018 23:06
@ghost ghost locked as resolved and limited conversation to collaborators Mar 26, 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.

4 participants