Why use None for the batch dimension in tensorflow?

Hossein

In the following code, the None is used to declare the size of the placeholders.

x_data = tf.placeholder(tf.int32, [None, max_sequence_length]) 
y_output = tf.placeholder(tf.int32, [None])

As I know, this None is used to specify a variable batch dimension. But, in each code, we have a variable that shows the batch size, such as:

batch_size = 250

So, is there any reason to use None in such cases instead of simply declaring the placeholders as?

x_data = tf.placeholder(tf.int32, [batch_size, max_sequence_length]) 
y_output = tf.placeholder(tf.int32, [batch_size])
Imanol Luengo

It is just so that the input of the network doesn't get bounded to a fixed-sized batches, and you can later reuse the learnt network to predict either single instances or arbitrarily long batches (e.g. predict all your test samples at once).

In other words, it doesn't do much during training, as batches are usually of a fixed size during tranning anyway, but it makes the network more useful when testing.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Drop a dimension of a tensor in Tensorflow

分類Dev

How to control dimension broadcast in tensorflow?

分類Dev

Iterate over a tensor dimension in Tensorflow

分類Dev

input dimension reshape in Tensorflow conolutional network

分類Dev

In Tensorflow dataset api: How to use padded_batch so that a pads with a specific value without specifying the number of pads

分類Dev

When to use ?, !, None, or Lazy?

分類Dev

Tensorflow tensordot for unknown batch size

分類Dev

Tensorflow with batch size and wrong dimesion

分類Dev

Why date is Dimension rather than Measure in Tableau?

分類Dev

TensorFlow 2.0 Layer with None type shape Tensor

分類Dev

Tensorflow: zip over first dimension of two tensors of different shape

分類Dev

Tensorflow and Batch Normalization with Batch Size==1 => Outputs all zeros

分類Dev

Tensorflow object detection: how to detect on batch

分類Dev

Why occurs a java.lang.NoClassDefFoundError when I use args4j in a batch built by mvn:assembly

分類Dev

Why "Display:none" is property not working properly

分類Dev

Why does "append('w')" return None?

分類Dev

Why does this recursive python function return None?

分類Dev

Why does PDFBox return image dimension of size 0 x 0

分類Dev

Why should I dimension my variables in VBA really?

分類Dev

Fortran, best use of DIMENSION when initializing array with PARAMETER attribute

分類Dev

dm-crypt / cryptsetup which block encryption dimension use

分類Dev

ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none) ERROR: No matching distribution found for tensorflow)

分類Dev

Tensorflow cannot initialize tf.Variable for dynamic batch size

分類Dev

Tensorflow、Estimator.fit(batch)にフィード

分類Dev

TensorFlowのBatch_size?概念を理解する

分類Dev

TensorFlow DataSet `from_generator` with variable batch size

分類Dev

Tensorflow:np配列のnext_batch関数

分類Dev

tensorflow count number of 0 at index 2 in a flatten-batch

分類Dev

Why is this wont work in BATCH, FOR command? Standallone it works

Related 関連記事

  1. 1

    Drop a dimension of a tensor in Tensorflow

  2. 2

    How to control dimension broadcast in tensorflow?

  3. 3

    Iterate over a tensor dimension in Tensorflow

  4. 4

    input dimension reshape in Tensorflow conolutional network

  5. 5

    In Tensorflow dataset api: How to use padded_batch so that a pads with a specific value without specifying the number of pads

  6. 6

    When to use ?, !, None, or Lazy?

  7. 7

    Tensorflow tensordot for unknown batch size

  8. 8

    Tensorflow with batch size and wrong dimesion

  9. 9

    Why date is Dimension rather than Measure in Tableau?

  10. 10

    TensorFlow 2.0 Layer with None type shape Tensor

  11. 11

    Tensorflow: zip over first dimension of two tensors of different shape

  12. 12

    Tensorflow and Batch Normalization with Batch Size==1 => Outputs all zeros

  13. 13

    Tensorflow object detection: how to detect on batch

  14. 14

    Why occurs a java.lang.NoClassDefFoundError when I use args4j in a batch built by mvn:assembly

  15. 15

    Why "Display:none" is property not working properly

  16. 16

    Why does "append('w')" return None?

  17. 17

    Why does this recursive python function return None?

  18. 18

    Why does PDFBox return image dimension of size 0 x 0

  19. 19

    Why should I dimension my variables in VBA really?

  20. 20

    Fortran, best use of DIMENSION when initializing array with PARAMETER attribute

  21. 21

    dm-crypt / cryptsetup which block encryption dimension use

  22. 22

    ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none) ERROR: No matching distribution found for tensorflow)

  23. 23

    Tensorflow cannot initialize tf.Variable for dynamic batch size

  24. 24

    Tensorflow、Estimator.fit(batch)にフィード

  25. 25

    TensorFlowのBatch_size?概念を理解する

  26. 26

    TensorFlow DataSet `from_generator` with variable batch size

  27. 27

    Tensorflow:np配列のnext_batch関数

  28. 28

    tensorflow count number of 0 at index 2 in a flatten-batch

  29. 29

    Why is this wont work in BATCH, FOR command? Standallone it works

ホットタグ

アーカイブ