Skip to content

Cursor creation fails on a dataview with sparse vectors #586

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
xadupre opened this issue Jul 27, 2018 · 0 comments
Closed

Cursor creation fails on a dataview with sparse vectors #586

xadupre opened this issue Jul 27, 2018 · 0 comments

Comments

@xadupre
Copy link
Contributor

xadupre commented Jul 27, 2018

System information

  • Windows 10.0.17134:
  • .NET Version 2.1.301:

Issue

  • The creation of a cursor on a dataview with sparse vectors does not work anymore.
  • Expected getter type is VBuffer, produced getter type is VBuffer<VBuffer>.

Source code / logs

The following code fails.

class ExampleASparse
{
[VectorType(5)]
public VBuffer X;
}

    [Fact]
    [TestCategory(Cat)]
    public void SparseDataView()
    {
        var inputs = new[] {
            new ExampleASparse() { X = new VBuffer<float> (5, 3, new float[] { 1, 10, 100 }, new int[] { 0, 2, 4 }) },
            new ExampleASparse() { X = new VBuffer<float> (5, 3, new float[] { 2, 3, 5 }, new int[] { 0, 1, 3 }) }
        };
        var host = new TlcEnvironment();
        var data = host.CreateStreamingDataView(inputs);
        VBuffer<float> value = new VBuffer<float>();
        int n = 0;
        using (var cur = data.GetRowCursor(i => true)) // it fails here
        {
            var getter = cur.GetGetter<VBuffer<float>>(0);
            while (cur.MoveNext())
            {
                getter(ref value);
                Assert.True(value.Count == 3);
                ++n;
            }
        }
        Assert.True(n == 2);
        Done();
    }
xadupre pushed a commit to xadupre/machinelearning that referenced this issue Jul 27, 2018
xadupre pushed a commit to xadupre/machinelearning that referenced this issue Jul 27, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Mar 29, 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

No branches or pull requests

1 participant