From 7fd455041d85dc4143a4a6e4d876b9c22be51f51 Mon Sep 17 00:00:00 2001
From: Wanglongzhi2001 <583087864@qq.com>
Date: Sun, 5 Nov 2023 21:51:33 +0800
Subject: [PATCH 1/2] refactor: refacter the place of the kernel unittest
folder
---
TensorFlow.NET.sln | 40 +++++++++----------
.../TensorFlow.Kernel.UnitTest.csproj | 4 +-
.../array_ops/concat_op_test.cs | 10 ++---
3 files changed, 26 insertions(+), 28 deletions(-)
rename {TensorFlow.Kernel.UnitTest => test/TensorFlow.Kernel.UnitTest}/TensorFlow.Kernel.UnitTest.csproj (74%)
rename {TensorFlow.Kernel.UnitTest => test/TensorFlow.Kernel.UnitTest}/array_ops/concat_op_test.cs (89%)
diff --git a/TensorFlow.NET.sln b/TensorFlow.NET.sln
index a246407b..214b039d 100644
--- a/TensorFlow.NET.sln
+++ b/TensorFlow.NET.sln
@@ -39,7 +39,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tensorflow.Benchmark", "too
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tensorflow.Console", "tools\TensorFlowNET.Console\Tensorflow.Console.csproj", "{1DC32255-BA1F-4D6D-A9C9-5BD5ED71CAA0}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TensorFlow.Kernel.UnitTest", "TensorFlow.Kernel.UnitTest\TensorFlow.Kernel.UnitTest.csproj", "{C08C6692-4818-46C1-8462-2F0CC40C9152}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TensorFlow.Kernel.UnitTest", "test\TensorFlow.Kernel.UnitTest\TensorFlow.Kernel.UnitTest.csproj", "{654A027D-1364-4729-880B-144DFE1FF5BB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -324,24 +324,24 @@ Global
{1DC32255-BA1F-4D6D-A9C9-5BD5ED71CAA0}.Release|x64.Build.0 = Release|x64
{1DC32255-BA1F-4D6D-A9C9-5BD5ED71CAA0}.Release|x86.ActiveCfg = Release|Any CPU
{1DC32255-BA1F-4D6D-A9C9-5BD5ED71CAA0}.Release|x86.Build.0 = Release|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.Debug|x64.ActiveCfg = Debug|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.Debug|x64.Build.0 = Debug|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.Debug|x86.ActiveCfg = Debug|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.Debug|x86.Build.0 = Debug|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.GPU|Any CPU.ActiveCfg = Debug|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.GPU|Any CPU.Build.0 = Debug|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.GPU|x64.ActiveCfg = Debug|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.GPU|x64.Build.0 = Debug|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.GPU|x86.ActiveCfg = Debug|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.GPU|x86.Build.0 = Debug|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.Release|Any CPU.Build.0 = Release|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.Release|x64.ActiveCfg = Release|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.Release|x64.Build.0 = Release|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.Release|x86.ActiveCfg = Release|Any CPU
- {C08C6692-4818-46C1-8462-2F0CC40C9152}.Release|x86.Build.0 = Release|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.Debug|x64.Build.0 = Debug|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.Debug|x86.Build.0 = Debug|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.GPU|Any CPU.ActiveCfg = Debug|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.GPU|Any CPU.Build.0 = Debug|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.GPU|x64.ActiveCfg = Debug|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.GPU|x64.Build.0 = Debug|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.GPU|x86.ActiveCfg = Debug|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.GPU|x86.Build.0 = Debug|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.Release|x64.ActiveCfg = Release|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.Release|x64.Build.0 = Release|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.Release|x86.ActiveCfg = Release|Any CPU
+ {654A027D-1364-4729-880B-144DFE1FF5BB}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -362,7 +362,7 @@ Global
{D24FCAA5-548C-4251-B226-A1B6535D0845} = {E1A5D2B7-10AF-4876-85C0-7714EF274214}
{C23563DB-FE21-48E7-A411-87A109E4A899} = {E1A5D2B7-10AF-4876-85C0-7714EF274214}
{1DC32255-BA1F-4D6D-A9C9-5BD5ED71CAA0} = {E1A5D2B7-10AF-4876-85C0-7714EF274214}
- {C08C6692-4818-46C1-8462-2F0CC40C9152} = {1B0918B9-65AD-4F34-A287-AF4597B27DBD}
+ {654A027D-1364-4729-880B-144DFE1FF5BB} = {1B0918B9-65AD-4F34-A287-AF4597B27DBD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2DEAD3CC-486B-4918-A607-50B0DE7B114A}
diff --git a/TensorFlow.Kernel.UnitTest/TensorFlow.Kernel.UnitTest.csproj b/test/TensorFlow.Kernel.UnitTest/TensorFlow.Kernel.UnitTest.csproj
similarity index 74%
rename from TensorFlow.Kernel.UnitTest/TensorFlow.Kernel.UnitTest.csproj
rename to test/TensorFlow.Kernel.UnitTest/TensorFlow.Kernel.UnitTest.csproj
index a52a4cda..68eb9e9b 100644
--- a/TensorFlow.Kernel.UnitTest/TensorFlow.Kernel.UnitTest.csproj
+++ b/test/TensorFlow.Kernel.UnitTest/TensorFlow.Kernel.UnitTest.csproj
@@ -17,8 +17,8 @@
-
-
+
+
diff --git a/TensorFlow.Kernel.UnitTest/array_ops/concat_op_test.cs b/test/TensorFlow.Kernel.UnitTest/array_ops/concat_op_test.cs
similarity index 89%
rename from TensorFlow.Kernel.UnitTest/array_ops/concat_op_test.cs
rename to test/TensorFlow.Kernel.UnitTest/array_ops/concat_op_test.cs
index cfa8f0fb..67d0aa60 100644
--- a/TensorFlow.Kernel.UnitTest/array_ops/concat_op_test.cs
+++ b/test/TensorFlow.Kernel.UnitTest/array_ops/concat_op_test.cs
@@ -1,9 +1,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tensorflow;
using Tensorflow.NumPy;
-using TensorFlow;
using static Tensorflow.Binding;
-using static Tensorflow.KerasApi;
namespace TensorFlow.Kernel.UnitTest
{
@@ -23,14 +21,14 @@ public void testConcatEmpty()
[TestMethod]
public void testConcatNegativeAxis()
{
- var t1 = tf.constant(new int[,] {{ 1, 2, 3 }, { 4, 5, 6 } });
+ var t1 = tf.constant(new int[,] { { 1, 2, 3 }, { 4, 5, 6 } });
var t2 = tf.constant(new int[,] { { 7, 8, 9 }, { 10, 11, 12 } });
var c = array_ops.concat(new[] { t1, t2 }, -2);
var expected = np.array(new int[,,] { { { 1, 2, 3 }, { 4, 5, 6 } }, { { 7, 8, 9 }, { 10, 11, 12 } } });
Assert.IsTrue(Enumerable.SequenceEqual(expected.ToArray(), c.numpy().ToArray()));
c = array_ops.concat(new[] { t1, t2 }, -1);
- expected = np.array(new int[,] { { 1, 2, 3, 7, 8, 9 }, { 4, 5, 6, 10, 11, 12 } });
+ expected = np.array(new int[,] { { 1, 2, 3, 7, 8, 9 }, { 4, 5, 6, 10, 11, 12 } });
Assert.IsTrue(Enumerable.SequenceEqual(expected.ToArray(), c.numpy().ToArray()));
}
@@ -54,7 +52,7 @@ public void testConcatDtype(TF_DataType dtype)
[DataRow(TF_DataType.TF_INT64)]
public void testConcatAxisType(TF_DataType dtype)
{
- var t1 = tf.constant(new int[,] { { 1, 2, 3 }, {4, 5, 6 } });
+ var t1 = tf.constant(new int[,] { { 1, 2, 3 }, { 4, 5, 6 } });
var t2 = tf.constant(new int[,] { { 7, 8, 9 }, { 10, 11, 12 } });
var c = array_ops.concat(new[] { t1, t2 }, tf.constant(1, dtype: dtype));
var expected = np.array(new int[,] { { 1, 2, 3, 7, 8, 9 }, { 4, 5, 6, 10, 11, 12 } });
@@ -62,4 +60,4 @@ public void testConcatAxisType(TF_DataType dtype)
}
}
-}
+}
\ No newline at end of file
From 7f0161445d1142f18ca2e18504e25fcad15e1d44 Mon Sep 17 00:00:00 2001
From: Wanglongzhi2001 <583087864@qq.com>
Date: Sun, 5 Nov 2023 21:54:56 +0800
Subject: [PATCH 2/2] fix: fix a project reference mistake
---
.../TensorFlow.Kernel.UnitTest.csproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/TensorFlow.Kernel.UnitTest/TensorFlow.Kernel.UnitTest.csproj b/test/TensorFlow.Kernel.UnitTest/TensorFlow.Kernel.UnitTest.csproj
index 68eb9e9b..21b2731b 100644
--- a/test/TensorFlow.Kernel.UnitTest/TensorFlow.Kernel.UnitTest.csproj
+++ b/test/TensorFlow.Kernel.UnitTest/TensorFlow.Kernel.UnitTest.csproj
@@ -17,8 +17,8 @@
+
-