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.

RaggedTensorTest.cs 820 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Microsoft.VisualStudio.TestTools.UnitTesting;
  7. using Tensorflow;
  8. using Tensorflow.NumPy;
  9. using static Tensorflow.Binding;
  10. namespace TensorFlowNET.UnitTest.ManagedAPI
  11. {
  12. public class RaggedTensorTest :EagerModeTestBase
  13. {
  14. [TestMethod]
  15. public void Test_from_row_lengths()
  16. {
  17. var row_lengths = tf.convert_to_tensor(np.array(new int[] { 2, 0, 3, 1, 1 }, TF_DataType.TF_INT64));
  18. var rp = RowPartition.from_row_lengths(row_lengths, validate: false);
  19. var rp_row_lengths = rp.row_lengths();
  20. var rp_nrows = rp.nrows();
  21. Assert.IsTrue(rp_nrows.ToArray<long>()[0] == rp.nrows().ToArray<long>()[0]);
  22. }
  23. }
  24. }