Skip to content
This repository was archived by the owner on Aug 11, 2025. It is now read-only.

Commit 3db1df1

Browse files
Dorokhovmigueldeicaza
authored andcommitted
Run tests on Travis (#151)
This CR introduces changes in the testing on Travis. Now, mono 5.2.0 used C# tests running on push native libraries being extracted from nuget package and it resolves #146 Downside of this - new version of nuget should be published before source code with upgrade pushed into the source control The test Should_ReduceMean() was broken by this commit, so I returned initial behavior
1 parent d3a3c3b commit 3db1df1

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

.travis.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
language: csharp
22
solution: TensorFlowSharp.sln
33
script:
4-
- wget "http://ci.tensorflow.org/view/Nightly/job/nightly-libtensorflow/TYPE=mac-slave/82/artifact/lib_package/libtensorflow-cpu-darwin-x86_64.tar.gz"
5-
- tar xzvf libtensorflow-cpu-darwin-x86_64.tar.gz lib/libtensorflow.so
6-
- mkdir -p native
7-
- cp lib/libtensorflow.so native/libtensorflow.dylib
8-
- cp lib/libtensorflow.so native/
4+
- tsh_version=1.3.0
5+
- wget "https://www.nuget.org/api/v2/package/TensorFlowSharp/$tsh_version"
6+
- tar xzvf $tsh_version native
97
- msbuild /t:Restore $TRAVIS_BUILD_DIR/TensorFlowSharp.sln
108
- cd $TRAVIS_BUILD_DIR/
119
- msbuild /p:Configuration=Release TensorFlowSharp.sln
1210
- cp -R $TRAVIS_BUILD_DIR/native/libtensorflow.dylib $TRAVIS_BUILD_DIR/tests/TensorFlowSharp.Tests/bin/Release/libtensorflow.dylib
13-
- sh $TRAVIS_BUILD_DIR/build.sh
14-
mono: "5.0.0"
11+
- cp -R $TRAVIS_BUILD_DIR/native/libtensorflow.dylib $TRAVIS_BUILD_DIR/tests/TensorFlowSharp.Tests.CSharp/bin/Release/libtensorflow.dylib
12+
- cd $TRAVIS_BUILD_DIR/packages/xunit.runner.console.2.2.0/tools
13+
- mono --arch=64 xunit.console.exe "$TRAVIS_BUILD_DIR/tests/TensorFlowSharp.Tests/bin/Release/TensorFlowSharp.Tests.dll" "$TRAVIS_BUILD_DIR/tests/TensorFlowSharp.Tests.CSharp/bin/Release/TensorFlowSharp.Tests.CSharp.dll"
14+
mono: "5.2.0"
1515
os: "osx"

TensorFlowSharp/OperationsExtras.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ TFOutput ReduceDims (TFOutput input, TFOutput? axis = null)
3131
if (shape.IsFullySpecified) {
3232
// The python code distinguishes between tensor and sparsetensor
3333

34-
return this.Const (shape.ToIntArray (), TFDataType.Int32);
34+
var array = new int [shape.NumDimensions];
35+
for (int i = 0; i < array.Length; i++)
36+
array [i] = i;
37+
38+
return this.Const (array, TFDataType.Int32);
3539
}
3640
// Otherwise, we rely on Range and Rank to do the right thing at run-time.
3741
return Range (Const (0), Rank (input), Const (1));

build.sh

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

0 commit comments

Comments
 (0)