From 86c8c208366583159ffa136f153352df31b0cabf Mon Sep 17 00:00:00 2001 From: AsakusaRinne Date: Sat, 29 Apr 2023 11:38:00 +0800 Subject: [PATCH 01/12] ci: update release ci. --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5afef6f2..65a0876f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,7 @@ on: workflows: ["build_and_test"] types: - completed + - required env: MYGET_API_TOKEN: ${{ SECRETS.RINNE_MYGET_KEY }} From ed04b056c8bbded5c5d6e8b5645104df2951926a Mon Sep 17 00:00:00 2001 From: AsakusaRinne Date: Sat, 29 Apr 2023 12:01:51 +0800 Subject: [PATCH 02/12] ci: update release ci. --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 65a0876f..24bdee05 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,6 @@ on: workflows: ["build_and_test"] types: - completed - - required env: MYGET_API_TOKEN: ${{ SECRETS.RINNE_MYGET_KEY }} @@ -31,6 +30,7 @@ jobs: - name: Build solution run: dotnet build -c Release --no-restore + # run-semantic-release: # runs-on: ubuntu-latest # needs: build From bd71915dc2135f583e8950aa7de282b101c03370 Mon Sep 17 00:00:00 2001 From: AsakusaRinne Date: Sat, 29 Apr 2023 12:34:25 +0800 Subject: [PATCH 03/12] ci: update ci files. --- .github/workflows/build_and_test.yml | 114 +++++++++++++-------------- .github/workflows/release.yml | 15 ++-- 2 files changed, 67 insertions(+), 62 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index ae6b7e63..1c9e0a43 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -1,65 +1,65 @@ -# This workflow will build a .NET project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net +# # This workflow will build a .NET project +# # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net -name: build_and_test +# name: build_and_test -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] +# on: +# push: +# branches: [ "master" ] +# pull_request: +# branches: [ "master" ] -jobs: - windows: +# jobs: +# windows: - runs-on: windows-latest +# runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - name: Setup .NET 6 - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 6.0.x - - name: Restore dependencies - run: dotnet restore - - name: Build CPU version - run: dotnet build --no-restore -# - name: Test CPU version -# run: dotnet test --no-build --verbosity normal - - name: uninstall redist cpu for unit tests - run: dotnet remove helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist - - name: install redist gpu for unit tests - run: dotnet add helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist-Windows-GPU - - name: Restore dependencies - run: dotnet restore - - name: Build GPU version - run: dotnet build --no-restore -# - name: Test GPU version -# run: dotnet test --no-build --verbosity normal +# steps: +# - uses: actions/checkout@v3 +# - name: Setup .NET 6 +# uses: actions/setup-dotnet@v3 +# with: +# dotnet-version: 6.0.x +# - name: Restore dependencies +# run: dotnet restore +# - name: Build CPU version +# run: dotnet build --no-restore +# # - name: Test CPU version +# # run: dotnet test --no-build --verbosity normal +# - name: uninstall redist cpu for unit tests +# run: dotnet remove helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist +# - name: install redist gpu for unit tests +# run: dotnet add helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist-Windows-GPU +# - name: Restore dependencies +# run: dotnet restore +# - name: Build GPU version +# run: dotnet build --no-restore +# # - name: Test GPU version +# # run: dotnet test --no-build --verbosity normal - linux: +# linux: - runs-on: ubuntu-latest +# runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 6.0.x - - name: Restore dependencies - run: dotnet restore - - name: Build CPU version - run: dotnet build --no-restore -# - name: Test CPU version -# run: dotnet test --no-build --verbosity normal - - name: uninstall redist cpu for unit tests - run: dotnet remove helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist - - name: install redist gpu for unit tests - run: dotnet add helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist-Linux-GPU - - name: Restore dependencies - run: dotnet restore - - name: Build GPU version - run: dotnet build --no-restore -# - name: Test GPU version -# run: dotnet test --no-build --verbosity normal +# steps: +# - uses: actions/checkout@v3 +# - name: Setup .NET +# uses: actions/setup-dotnet@v3 +# with: +# dotnet-version: 6.0.x +# - name: Restore dependencies +# run: dotnet restore +# - name: Build CPU version +# run: dotnet build --no-restore +# # - name: Test CPU version +# # run: dotnet test --no-build --verbosity normal +# - name: uninstall redist cpu for unit tests +# run: dotnet remove helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist +# - name: install redist gpu for unit tests +# run: dotnet add helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist-Linux-GPU +# - name: Restore dependencies +# run: dotnet restore +# - name: Build GPU version +# run: dotnet build --no-restore +# # - name: Test GPU version +# # run: dotnet test --no-build --verbosity normal diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 24bdee05..3acab001 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,14 @@ -name: release +name: auto-release on: - workflow_run: - workflows: ["build_and_test"] - types: - - completed + # workflow_run: + # workflows: ["build_and_test"] + # types: + # - completed + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] env: MYGET_API_TOKEN: ${{ SECRETS.RINNE_MYGET_KEY }} @@ -12,6 +16,7 @@ env: jobs: build: + if: ${{ github.event.label.name == 'auto-release'}} runs-on: windows-latest steps: From 663d7fc784fb680b84053c2fc4204c93918d6fb0 Mon Sep 17 00:00:00 2001 From: AsakusaRinne Date: Sat, 29 Apr 2023 12:36:24 +0800 Subject: [PATCH 04/12] ci: update ci files. --- .github/workflows/release.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3acab001..a9728c59 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,10 +5,11 @@ on: # workflows: ["build_and_test"] # types: # - completed - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] + [push, pull_request] + # push: + # branches: [ "master" ] + # pull_request: + # branches: [ "master" ] env: MYGET_API_TOKEN: ${{ SECRETS.RINNE_MYGET_KEY }} From 2bf5e7820babd8e36b2499ef8261b275f3db9e15 Mon Sep 17 00:00:00 2001 From: AsakusaRinne Date: Sat, 29 Apr 2023 12:41:37 +0800 Subject: [PATCH 05/12] ci: update ci files. --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a9728c59..2a5ae106 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,11 +1,11 @@ name: auto-release -on: +on: workflow_dispatch # workflow_run: # workflows: ["build_and_test"] # types: # - completed - [push, pull_request] + # push: # branches: [ "master" ] # pull_request: From 78e32c162aa4fff6d8d904452e3a0f41ff8e1dc7 Mon Sep 17 00:00:00 2001 From: AsakusaRinne Date: Sat, 29 Apr 2023 12:45:07 +0800 Subject: [PATCH 06/12] ci: update ci files. --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2a5ae106..56676473 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,11 +1,11 @@ name: auto-release -on: workflow_dispatch +on: # workflow_run: # workflows: ["build_and_test"] # types: # - completed - + [push, pull_request] # push: # branches: [ "master" ] # pull_request: @@ -17,7 +17,7 @@ env: jobs: build: - if: ${{ github.event.label.name == 'auto-release'}} + # if: ${{ github.event.label.name == 'auto-release'}} runs-on: windows-latest steps: From 33013b73f02d9ba22dd2747bb5f80e145d9d25d2 Mon Sep 17 00:00:00 2001 From: AsakusaRinne Date: Sat, 29 Apr 2023 13:14:50 +0800 Subject: [PATCH 07/12] ci: update ci files. --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 56676473..89886f2b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ on: # workflows: ["build_and_test"] # types: # - completed - [push, pull_request] + [pull_request] # push: # branches: [ "master" ] # pull_request: @@ -74,6 +74,7 @@ jobs: - name: Pack packages run: | + git fetch; $LastTag = git describe --tags (git rev-list --tags --max-count=1); echo "Last tag is: $LastTag"; $Version = ($LastTag).TrimStart('v'); From 54aa3840e9b577d778334d32b6eed296854087a6 Mon Sep 17 00:00:00 2001 From: AsakusaRinne Date: Sat, 29 Apr 2023 18:52:55 +0800 Subject: [PATCH 08/12] ci: update release ci and hub package info. --- .github/workflows/release.yml | 27 +++++++++++---------- src/TensorflowNET.Hub/Tensorflow.Hub.csproj | 2 +- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 89886f2b..bedd9dc6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,15 +1,10 @@ name: auto-release on: - # workflow_run: - # workflows: ["build_and_test"] - # types: - # - completed - [pull_request] - # push: - # branches: [ "master" ] - # pull_request: - # branches: [ "master" ] + workflow_run: + workflows: ["build_and_test"] + types: + - completed env: MYGET_API_TOKEN: ${{ SECRETS.RINNE_MYGET_KEY }} @@ -17,7 +12,7 @@ env: jobs: build: - # if: ${{ github.event.label.name == 'auto-release'}} + if: ${{ github.event.label.name == 'auto-release'}} runs-on: windows-latest steps: @@ -75,7 +70,7 @@ jobs: - name: Pack packages run: | git fetch; - $LastTag = git describe --tags (git rev-list --tags --max-count=1); + $LastTag = git describe --tags; echo "Last tag is: $LastTag"; $Version = ($LastTag).TrimStart('v'); echo "Publishing version: $Version"; @@ -96,5 +91,11 @@ jobs: - name: Add myget nuget source run: dotnet nuget add source https://www.myget.org/F/rinne/api/v2/package --name myget.org - - name: Push packages to myget.org - run: dotnet nuget push .\packages\TensorFlow*.nupkg -s myget.org -k $env:MYGET_API_TOKEN --skip-duplicate + - name: Push TensorFlow.NET to myget.org + run: dotnet nuget push .\packages\TensorFlow.NET.nupkg -s myget.org -k $env:MYGET_API_TOKEN --skip-duplicate + + - name: Push TensorFlow.Keras to myget.org + run: dotnet nuget push .\packages\TensorFlow.Keras.nupkg -s myget.org -k $env:MYGET_API_TOKEN --skip-duplicate + + - name: Push TensorFlow.Hub to myget.org + run: dotnet nuget push .\packages\TensorFlow.Hub.nupkg -s myget.org -k $env:MYGET_API_TOKEN --skip-duplicate diff --git a/src/TensorflowNET.Hub/Tensorflow.Hub.csproj b/src/TensorflowNET.Hub/Tensorflow.Hub.csproj index fef8b34f..1e688ac9 100644 --- a/src/TensorflowNET.Hub/Tensorflow.Hub.csproj +++ b/src/TensorflowNET.Hub/Tensorflow.Hub.csproj @@ -5,7 +5,7 @@ 10 enable 1.0.0 - TensorFlow.NET.Hub + TensorFlow.Hub Apache2.0 true true From 3e1787d344959fecbb53cdf99ae7137a4b47c8ca Mon Sep 17 00:00:00 2001 From: AsakusaRinne Date: Sat, 29 Apr 2023 18:57:14 +0800 Subject: [PATCH 09/12] ci: revise build_and_test ci. --- .github/workflows/build_and_test.yml | 115 ++++++++++++++------------- 1 file changed, 58 insertions(+), 57 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 1c9e0a43..0c14626f 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -1,65 +1,66 @@ -# # This workflow will build a .NET project -# # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net +# This workflow will build a .NET project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net -# name: build_and_test +name: build_and_test -# on: -# push: -# branches: [ "master" ] -# pull_request: -# branches: [ "master" ] +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + types: ["opened", "reopened", "synchronize", "ready_for_review", "auto_merge_enabled"] -# jobs: -# windows: +jobs: + windows: -# runs-on: windows-latest + runs-on: windows-latest -# steps: -# - uses: actions/checkout@v3 -# - name: Setup .NET 6 -# uses: actions/setup-dotnet@v3 -# with: -# dotnet-version: 6.0.x -# - name: Restore dependencies -# run: dotnet restore -# - name: Build CPU version -# run: dotnet build --no-restore -# # - name: Test CPU version -# # run: dotnet test --no-build --verbosity normal -# - name: uninstall redist cpu for unit tests -# run: dotnet remove helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist -# - name: install redist gpu for unit tests -# run: dotnet add helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist-Windows-GPU -# - name: Restore dependencies -# run: dotnet restore -# - name: Build GPU version -# run: dotnet build --no-restore -# # - name: Test GPU version -# # run: dotnet test --no-build --verbosity normal + steps: + - uses: actions/checkout@v3 + - name: Setup .NET 6 + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build CPU version + run: dotnet build --no-restore + - name: Test CPU version + run: dotnet test --no-build --verbosity normal + - name: uninstall redist cpu for unit tests + run: dotnet remove helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist + - name: install redist gpu for unit tests + run: dotnet add helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist-Windows-GPU + - name: Restore dependencies + run: dotnet restore + - name: Build GPU version + run: dotnet build --no-restore +# - name: Test GPU version +# run: dotnet test --no-build --verbosity normal -# linux: + linux: -# runs-on: ubuntu-latest + runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v3 -# - name: Setup .NET -# uses: actions/setup-dotnet@v3 -# with: -# dotnet-version: 6.0.x -# - name: Restore dependencies -# run: dotnet restore -# - name: Build CPU version -# run: dotnet build --no-restore -# # - name: Test CPU version -# # run: dotnet test --no-build --verbosity normal -# - name: uninstall redist cpu for unit tests -# run: dotnet remove helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist -# - name: install redist gpu for unit tests -# run: dotnet add helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist-Linux-GPU -# - name: Restore dependencies -# run: dotnet restore -# - name: Build GPU version -# run: dotnet build --no-restore -# # - name: Test GPU version -# # run: dotnet test --no-build --verbosity normal + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build CPU version + run: dotnet build --no-restore + - name: Test CPU version + run: dotnet test --no-build --verbosity normal + - name: uninstall redist cpu for unit tests + run: dotnet remove helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist + - name: install redist gpu for unit tests + run: dotnet add helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist-Linux-GPU + - name: Restore dependencies + run: dotnet restore + - name: Build GPU version + run: dotnet build --no-restore +# - name: Test GPU version +# run: dotnet test --no-build --verbosity normal From f76857f6d39294904be48266c23798d5de36b55f Mon Sep 17 00:00:00 2001 From: AsakusaRinne Date: Sat, 29 Apr 2023 19:12:45 +0800 Subject: [PATCH 10/12] test: add tolorance to float NDArray comparison. --- test/TensorFlowNET.Keras.UnitTest/Layers/ActivationTest.cs | 2 +- test/TensorFlowNET.Keras.UnitTest/Layers/AttentionTest.cs | 2 +- test/TensorFlowNET.Keras.UnitTest/Losses/LossesTest.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/ActivationTest.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/ActivationTest.cs index 75fcc023..cc99f4a0 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/ActivationTest.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Layers/ActivationTest.cs @@ -49,7 +49,7 @@ namespace Tensorflow.Keras.UnitTest.Layers Tensor input = tf.constant(new float[] { -3f, -2f, -1f, 0f, 1f, 2f }); Tensor output = keras.layers.Softplus().Apply(input); NDArray expected = new NDArray(new float[] { 0.04858733f, 0.12692805f, 0.31326166f, 0.6931472f, 1.3132616f, 2.126928f }); - Assert.AreEqual(expected, output.numpy()); + Assert.IsTrue(expected == output.numpy()); } [TestMethod] diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/AttentionTest.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/AttentionTest.cs index 162a10d2..95ef923e 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/AttentionTest.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Layers/AttentionTest.cs @@ -94,7 +94,7 @@ namespace Tensorflow.Keras.UnitTest.Layers { 7.6400003f, 12.24f, 16.84f }, { 14.24f, 22.84f, 31.439999f } } }, dtype: np.float32); - Assert.AreEqual(expected, actual.numpy()); + Assert.IsTrue(expected == actual.numpy()); } [TestMethod] diff --git a/test/TensorFlowNET.Keras.UnitTest/Losses/LossesTest.cs b/test/TensorFlowNET.Keras.UnitTest/Losses/LossesTest.cs index 3bec2f17..0bb1d011 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Losses/LossesTest.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Losses/LossesTest.cs @@ -39,7 +39,7 @@ public class LossesTest : EagerModeTestBase // Using 'none' reduction type. bce = tf.keras.losses.BinaryCrossentropy(from_logits: true, reduction: Reduction.NONE); loss = bce.Call(y_true, y_pred); - Assert.AreEqual(new float[] { 0.23515666f, 1.4957594f }, loss.numpy()); + Assert.IsTrue(new NDArray(new float[] { 0.23515666f, 1.4957594f }) == loss.numpy()); } /// From 91474e6b2464394ea9db1b033870681957bfe9b0 Mon Sep 17 00:00:00 2001 From: AsakusaRinne Date: Sat, 29 Apr 2023 19:24:34 +0800 Subject: [PATCH 11/12] ci: disable linux test. --- .github/workflows/build_and_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 0c14626f..070c7cbd 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -52,8 +52,8 @@ jobs: run: dotnet restore - name: Build CPU version run: dotnet build --no-restore - - name: Test CPU version - run: dotnet test --no-build --verbosity normal + # - name: Test CPU version + # run: dotnet test --no-build --verbosity normal - name: uninstall redist cpu for unit tests run: dotnet remove helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist - name: install redist gpu for unit tests From b731c34903f3d351035a4c1aa11b853c2391b34d Mon Sep 17 00:00:00 2001 From: AsakusaRinne Date: Sat, 29 Apr 2023 19:46:00 +0800 Subject: [PATCH 12/12] ci: update release ci. --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bedd9dc6..977e340e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,6 @@ jobs: - name: Build solution run: dotnet build -c Release --no-restore - # run-semantic-release: # runs-on: ubuntu-latest # needs: build