Skip to content

Commit

Permalink
Export WordEmbeddingsTransform to ONNX (#1249)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaeksare authored Oct 25, 2018
1 parent 64f68da commit 0cdde0f
Show file tree
Hide file tree
Showing 6 changed files with 1,426 additions and 6 deletions.
19 changes: 18 additions & 1 deletion src/Microsoft.ML.Core/Utilities/BigArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Collections;
using System.Collections.Generic;

namespace Microsoft.ML.Runtime.Internal.Utilities
{
Expand All @@ -17,7 +19,7 @@ namespace Microsoft.ML.Runtime.Internal.Utilities
/// than the total capacity.
/// </summary>
/// <typeparam name="T">The type of entries.</typeparam>
public sealed class BigArray<T>
public sealed class BigArray<T> : IEnumerable<T>
{
// REVIEW: This class merges and replaces the original private BigArray implementation in CacheDataView.
// There the block size was 25 bits. Need to understand the performance implication of this 32x change.
Expand Down Expand Up @@ -454,5 +456,20 @@ private static void LongLimToMajorMaxMinorLim(long lim, out int major, out int m
minor = (int)((lim & BlockSizeMinusOne) + 1);
Contracts.Assert((long)major * BlockSize + minor == lim + 1);
}

public IEnumerator<T> GetEnumerator()
{
long cur = 0;
while (cur < _length)
{
yield return this[cur];
cur++;
}
}

IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}
Loading

0 comments on commit 0cdde0f

Please sign in to comment.