Skip to content

Commit 38d3b59

Browse files
authored
Make whitening tests work on hosted macs (dotnet#1530)
1 parent 118846d commit 38d3b59

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

.vsts-dotnet-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ phases:
3636
name: MacOS
3737
buildScript: ./build.sh
3838
queue:
39-
name: DotNetCore-Mac
39+
name: Hosted macOS

build.proj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@
7575
<MSBuild Projects="@(PkgProject)"
7676
Targets="Pack" />
7777
</Target>
78-
79-
<ItemGroup>
80-
<TestFile Include="$(MSBuildThisFileDirectory)/test/data/external/winequality-white.csv"
81-
Url="https://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-white.csv"
82-
DestinationFile="$(MSBuildThisFileDirectory)test/data/external/winequality-white.csv" />
83-
</ItemGroup>
8478

8579
<ItemGroup Condition="'$(IncludeBenchmarkData)' == 'true'">
8680
<BenchmarkFile Update="@(BenchmarkFile)">

build/ci/phase-template.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ phases:
2222
- script: $(_buildScript) -$(_configuration) -buildArch=$(_arch)
2323
displayName: Build
2424
- ${{ if eq(parameters.name, 'MacOS') }}:
25-
- script: brew install libomp
26-
displayName: Install OpenMP runtime dependency
25+
- script: brew install libomp mono-libgdiplus gettext && brew link gettext --force
26+
displayName: Install runtime dependencies
2727
- script: $(_buildScript) -$(_configuration) -runtests
2828
displayName: Run Tests
2929
- task: PublishTestResults@2

src/Microsoft.ML.Transforms/WhiteningTransform.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,15 @@ private void TrainModels(Float[][] columnData, int[] rowCounts, IChannel ch)
331331
int crow = rowCounts[iinfo];
332332
int ccol = Infos[iinfo].TypeSrc.ValueCount;
333333

334+
// If there is no training data, simply initialize the model matrices.
335+
if (crow == 0)
336+
{
337+
var matrixSize = ccol * ccol;
338+
_models[iinfo] = new float[matrixSize];
339+
InvModels[iinfo] = new float[matrixSize];
340+
continue;
341+
}
342+
334343
// Compute covariance matrix (sigma).
335344
var u = new Float[ccol * ccol];
336345
ch.Info("Computing covariance matrix...");

0 commit comments

Comments
 (0)