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.

tf.queue.cs 4.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*****************************************************************************
  2. Copyright 2018 The TensorFlow.NET Authors. All Rights Reserved.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ******************************************************************************/
  13. using System;
  14. using Tensorflow.Queues;
  15. namespace Tensorflow
  16. {
  17. public partial class tensorflow
  18. {
  19. /// <summary>
  20. /// A FIFOQueue that supports batching variable-sized tensors by padding.
  21. /// </summary>
  22. /// <param name="capacity"></param>
  23. /// <param name="dtypes"></param>
  24. /// <param name="shapes"></param>
  25. /// <param name="names"></param>
  26. /// <param name="shared_name"></param>
  27. /// <param name="name"></param>
  28. /// <returns></returns>
  29. public PaddingFIFOQueue PaddingFIFOQueue(int capacity,
  30. TF_DataType[] dtypes,
  31. TensorShape[] shapes,
  32. string[] names = null,
  33. string shared_name = null,
  34. string name = "padding_fifo_queue")
  35. => new PaddingFIFOQueue(capacity,
  36. dtypes,
  37. shapes,
  38. names,
  39. shared_name: shared_name,
  40. name: name);
  41. public PaddingFIFOQueue PaddingFIFOQueue(int capacity,
  42. TF_DataType dtype,
  43. TensorShape shape,
  44. string shared_name = null,
  45. string name = "padding_fifo_queue")
  46. => new PaddingFIFOQueue(capacity,
  47. new[] { dtype },
  48. new[] { shape },
  49. shared_name: shared_name,
  50. name: name);
  51. /// <summary>
  52. /// A queue implementation that dequeues elements in first-in first-out order.
  53. /// </summary>
  54. /// <param name="capacity"></param>
  55. /// <param name="dtypes"></param>
  56. /// <param name="shapes"></param>
  57. /// <param name="names"></param>
  58. /// <param name="shared_name"></param>
  59. /// <param name="name"></param>
  60. /// <returns></returns>
  61. public FIFOQueue FIFOQueue(int capacity,
  62. TF_DataType[] dtypes,
  63. TensorShape[] shapes = null,
  64. string[] names = null,
  65. string shared_name = null,
  66. string name = "fifo_queue")
  67. => new FIFOQueue(capacity,
  68. dtypes,
  69. shapes,
  70. names,
  71. shared_name: shared_name,
  72. name: name);
  73. public FIFOQueue FIFOQueue(int capacity,
  74. TF_DataType dtype,
  75. TensorShape shape = null,
  76. string shared_name = null,
  77. string name = "fifo_queue")
  78. => new FIFOQueue(capacity,
  79. new[] { dtype },
  80. new[] { shape ?? new TensorShape() },
  81. shared_name: shared_name,
  82. name: name);
  83. /// <summary>
  84. /// Creates a queue that dequeues elements in a first-in first-out order.
  85. /// </summary>
  86. /// <param name="capacity"></param>
  87. /// <param name="dtype"></param>
  88. /// <param name="shape"></param>
  89. /// <param name="shared_name"></param>
  90. /// <param name="name"></param>
  91. /// <returns></returns>
  92. public PriorityQueue PriorityQueue(int capacity,
  93. TF_DataType dtype,
  94. TensorShape shape = null,
  95. string shared_name = null,
  96. string name = "priority_queue")
  97. => new PriorityQueue(capacity,
  98. new[] { dtype },
  99. new[] { shape ?? new TensorShape() },
  100. shared_name: shared_name,
  101. name: name);
  102. public RandomShuffleQueue RandomShuffleQueue(int capacity,
  103. int min_after_dequeue,
  104. TF_DataType dtype,
  105. TensorShape shape = null,
  106. int? seed = null,
  107. string shared_name = null,
  108. string name = "random_shuffle_queue")
  109. => new RandomShuffleQueue(capacity,
  110. min_after_dequeue: min_after_dequeue,
  111. new[] { dtype },
  112. new[] { shape ?? new TensorShape() },
  113. seed: seed,
  114. shared_name: shared_name,
  115. name: name);
  116. }
  117. }