You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Randomize.Test.cs 726 B

4 years ago
123456789101112131415161718192021222324252627
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using Tensorflow;
  7. using Tensorflow.NumPy;
  8. namespace TensorFlowNET.UnitTest.NumPy
  9. {
  10. /// <summary>
  11. /// https://numpy.org/doc/1.20/reference/random/index.html
  12. /// </summary>
  13. [TestClass]
  14. public class RandomizeTest : EagerModeTestBase
  15. {
  16. [TestMethod]
  17. public void permutation()
  18. {
  19. var x = np.random.permutation(10);
  20. Assert.AreEqual(x.shape, 10);
  21. var y = np.random.permutation(x);
  22. Assert.AreEqual(x.shape, 10);
  23. Assert.AreNotEqual(x.ToArray<int>(), y.ToArray<int>());
  24. }
  25. }
  26. }