// // Copy the data of the Value object into the buffer provided by 'sequences'. // The 'sequences' is a list of sequences with variable length. // The number of items contained in the outer list of 'sequences' is the number of sequences in the Value object. // Each element of the outer list represents a sequence. // Each sequence, represented by List<uint>, contains a variable number of samples. // Each sample is represented by an index of the OneHot vector. The size of the OneHot vector should match that defined in the variable. // The number of samples = the count of elements in List<uint>. // public static void CopyVariableValueTo(this Value value, Variable sampleVariable, List <List <uint> > sequences) { if (sampleVariable.Shape[0] != sampleVariable.Shape.TotalSize) { throw new ArgumentException("The sample variable's leading axis dimensionality must equal to the total size of the shape for sparse data"); } var seqVec = new SizeTVectorVector(); value.CopyVariableValueTo(sampleVariable, seqVec); sequences.Clear(); foreach (var seq in seqVec) { sequences.Add(new List <uint>(seq)); } return; }