Skip to content

refactor: python test common class moved to a separate common assembly#1215

Merged
Wanglongzhi2001 merged 5 commits intoSciSharp:masterfrom
novikov-alexander:alnovi/pythontests_common
Nov 11, 2023
Merged

refactor: python test common class moved to a separate common assembly#1215
Wanglongzhi2001 merged 5 commits intoSciSharp:masterfrom
novikov-alexander:alnovi/pythontests_common

Conversation

@novikov-alexander
Copy link
Contributor

No description provided.

@novikov-alexander
Copy link
Contributor Author

@AsakusaRinne in this project nullable is enabled by default. I can change if needed.

@novikov-alexander
Copy link
Contributor Author

@AsakusaRinne I can convert it to fsproj if needed to force users use F# in tests. However, I think it doesn't make sense for a class.

@novikov-alexander
Copy link
Contributor Author

@AsakusaRinne how to get value of Ndarray if an Ndarray is a scalar?

@Oceania2018
Copy link
Member

@AsakusaRinne how to get value of Ndarray if an Ndarray is a scalar?

You can just use int a = nd; for implication converting.

@Oceania2018
Copy link
Member

  Error Message:
   Test method TensorFlowNET.UnitTest.Gradient.GradientTest.testDependentYs threw exception: 
System.NotImplementedException: 
  Stack Trace:
      at Tensorflow.NumPy.np.allclose(NDArray a, NDArray b, Double rtol, Double atol, Boolean equal_nan) in /home/runner/work/TensorFlow.NET/TensorFlow.NET/src/TensorFlowNET.Core/Numpy/Numpy.cs:line 69
   at TensorFlowNET.UnitTest.PythonTest.assertAllClose(Double value, NDArray array2, Double eps) in /home/runner/work/TensorFlow.NET/TensorFlow.NET/test/Tensorflow.UnitTest/PythonTest.cs:line 142
   at TensorFlowNET.UnitTest.Gradient.GradientTest.testDependentYs() in /home/runner/work/TensorFlow.NET/TensorFlow.NET/test/TensorFlowNET.Graph.UnitTest/GradientTest/GradientTest.cs:line 600

@novikov-alexander novikov-alexander force-pushed the alnovi/pythontests_common branch from 8e3ea3a to 7968dc3 Compare November 11, 2023 05:55
@novikov-alexander
Copy link
Contributor Author

novikov-alexander commented Nov 11, 2023

  Error Message:
   Test method TensorFlowNET.UnitTest.Gradient.GradientTest.testDependentYs threw exception: 
System.NotImplementedException: 
  Stack Trace:
      at Tensorflow.NumPy.np.allclose(NDArray a, NDArray b, Double rtol, Double atol, Boolean equal_nan) in /home/runner/work/TensorFlow.NET/TensorFlow.NET/src/TensorFlowNET.Core/Numpy/Numpy.cs:line 69
   at TensorFlowNET.UnitTest.PythonTest.assertAllClose(Double value, NDArray array2, Double eps) in /home/runner/work/TensorFlow.NET/TensorFlow.NET/test/Tensorflow.UnitTest/PythonTest.cs:line 142
   at TensorFlowNET.UnitTest.Gradient.GradientTest.testDependentYs() in /home/runner/work/TensorFlow.NET/TensorFlow.NET/test/TensorFlowNET.Graph.UnitTest/GradientTest/GradientTest.cs:line 600

Yes, one of the tests wasn't fully enabled before (in one of my previous PRs). Now the assertion works correctly and the error above is fixed.

@novikov-alexander
Copy link
Contributor Author

novikov-alexander commented Nov 11, 2023

@AsakusaRinne how to get value of Ndarray if an Ndarray is a scalar?

You can just use int a = nd; for implication converting.

Thank you! I was confused by the fact that .ToArray() doesn't work properly on a scalar. May be this is correct behaviour and it should throw exceptions.

@Wanglongzhi2001 Wanglongzhi2001 merged commit 8cab730 into SciSharp:master Nov 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants