Skip to content

Cursor creation fails on a dataview with sparse vectors #586

Closed
@xadupre

Description

@xadupre

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();
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions