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.

EmbeddingTest.cs 944 B

1234567891011121314151617181920212223242526272829
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using Tensorflow.Keras.Engine;
  6. using Tensorflow.Keras.Layers;
  7. using NumSharp;
  8. namespace TensorFlowNET.UnitTest.Keras
  9. {
  10. [TestClass]
  11. public class EmbeddingTest
  12. {
  13. [TestMethod]
  14. public void Embedding()
  15. {
  16. var model = new Sequential();
  17. model.add(new Embedding(1000, 64, input_length: 10));
  18. // the model will take as input an integer matrix of size (batch,
  19. // input_length).
  20. // the largest integer (i.e. word index) in the input should be no larger
  21. // than 999 (vocabulary size).
  22. // now model.output_shape == (None, 10, 64), where None is the batch
  23. // dimension.
  24. var input_array = np.random.randint(1000, size: (32, 10));
  25. model.compile("rmsprop", "mse");
  26. }
  27. }
  28. }