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.

BaseTests.cs 762 B

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
1234567891011121314151617181920212223242526
  1. using Tensorflow;
  2. using Keras.Layers;
  3. using NumSharp;
  4. using Microsoft.VisualStudio.TestTools.UnitTesting;
  5. namespace Keras.Test
  6. {
  7. [TestClass]
  8. public class BaseTests
  9. {
  10. [TestMethod]
  11. public void Dense_Tensor_ShapeTest()
  12. {
  13. var dense_1 = new Dense(1, name: "dense_1", activation: tf.nn.relu());
  14. var input = new Tensor(np.array(new int[] { 3 }));
  15. dense_1.__build__(input.TensorShape);
  16. var outputShape = dense_1.output_shape(input.TensorShape);
  17. var a = (int[])(outputShape.Dimensions);
  18. var b = (int[])(new int[] { 1 });
  19. var _a = np.array(a);
  20. var _b = np.array(b);
  21. Assert.IsTrue(np.array_equal(_a, _b));
  22. }
  23. }
  24. }