Skip to content

Commit dca6f24

Browse files
committed
merge DvBool.
1 parent 300253b commit dca6f24

File tree

5 files changed

+8
-235
lines changed

5 files changed

+8
-235
lines changed

src/Microsoft.ML.Api/DataViewConstructionUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private Delegate CreateGetter(int index)
158158
Ch.Assert(colType.IsText);
159159
return CreateConvertingGetterDelegate<String, ReadOnlyMemory<char>>(index, x => x != null ? x.AsMemory() : "".AsMemory());
160160
}
161-
161+
162162
// T -> T
163163
if (outputType.IsGenericType && outputType.GetGenericTypeDefinition() == typeof(Nullable<>))
164164
Ch.Assert(colType.RawType == Nullable.GetUnderlyingType(outputType));

src/Microsoft.ML.Api/TypedCursor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ private Action<TRow> GenerateSetter(IRow input, int index, InternalSchemaDefinit
310310
Ch.Assert(peek == null);
311311
return CreateConvertingActionSetter<ReadOnlyMemory<char>, string>(input, index, poke, x => x.ToString());
312312
}
313-
313+
314314
// T -> T
315315
if (fieldType.IsGenericType && fieldType.GetGenericTypeDefinition() == typeof(Nullable<>))
316316
Ch.Assert(colType.RawType == Nullable.GetUnderlyingType(fieldType));

src/Microsoft.ML.Core/Data/DvBool.cs

Lines changed: 0 additions & 226 deletions
This file was deleted.

src/Microsoft.ML.Data/Data/Conversion.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,7 +1551,7 @@ private U8 ParseU8(ref TX span)
15511551
public bool TryParse(ref TX src, out BL dst)
15521552
{
15531553
Contracts.Check(!IsStdMissing(ref src), "Missing text values cannot be converted to bool value.");
1554-
1554+
15551555
char ch;
15561556
switch (src.Length)
15571557
{
@@ -1720,7 +1720,6 @@ public void Convert(ref TX span, ref TX value)
17201720
}
17211721
public void Convert(ref TX span, ref BL value)
17221722
{
1723-
Contracts.Check(!span.IsNA, "Missing text values cannot be converted to bool value.");
17241723
// When TryParseBL returns false, it should have set value to false.
17251724
if (!TryParse(ref span, out value))
17261725
Contracts.Assert(!value);
@@ -1750,10 +1749,10 @@ public void Convert(ref TX span, ref DZ value)
17501749
#endregion FromTX
17511750

17521751
#region FromBL
1753-
public void Convert(ref BL src, ref I1 dst) => dst = (I1)src;
1754-
public void Convert(ref BL src, ref I2 dst) => dst = (I2)src;
1755-
public void Convert(ref BL src, ref I4 dst) => dst = (I4)src;
1756-
public void Convert(ref BL src, ref I8 dst) => dst = (I8)src;
1752+
public void Convert(ref BL src, ref I1 dst) => dst = (I1)(object)src;
1753+
public void Convert(ref BL src, ref I2 dst) => dst = (I2)(object)src;
1754+
public void Convert(ref BL src, ref I4 dst) => dst = (I4)(object)src;
1755+
public void Convert(ref BL src, ref I8 dst) => dst = (I8)(object)src;
17571756
public void Convert(ref BL src, ref R4 dst) => dst = System.Convert.ToSingle(src);
17581757
public void Convert(ref BL src, ref R8 dst) => dst = System.Convert.ToDouble(src);
17591758
public void Convert(ref BL src, ref BL dst) => dst = src;

test/Microsoft.ML.Tests/LearningPipelineTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public class BooleanLabelData
120120
public float[] Features;
121121

122122
[ColumnName("Label")]
123-
public DvBool Label;
123+
public bool Label;
124124
}
125125

126126
[Fact]

0 commit comments

Comments
 (0)