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.

Manipulation.Test.cs 732 B

4 years ago
12345678910111213141516171819202122232425262728
  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/stable/reference/routines.array-manipulation.html
  12. /// </summary>
  13. [TestClass]
  14. public class ManipulationTest : EagerModeTestBase
  15. {
  16. [TestMethod]
  17. public void expand_dims()
  18. {
  19. var x = np.array(new[] { 1, 2 });
  20. var y = np.expand_dims(x, axis: 0);
  21. Assert.AreEqual(y.shape, (1, 2));
  22. y = np.expand_dims(x, axis: 1);
  23. Assert.AreEqual(y.shape, (2, 1));
  24. }
  25. }
  26. }