How to set form in placeholder for non-deterministic array size

I want to prepare data that resize an array. For example, suppose we want to train sentences. The first sentence is "I am John," and the second is "I know." If the sentences are converted to tensor. The first will be ["I", "I", "John"], and the next will be ["I", "know"]. Therefore, the first array will need 3 as n_input for the placeholder form. However, the second array requires 2.

x = tf.placeholder("float", [None, n_input])
y = tf.placeholder("float", [None, n_classes])

I will need the code above to determine the placeholder. However, I cannot define n_input.

Also, what does being out of shape mean? batch size? Please help me.

+4
source share
2

. .

x =tf.placeholder(tf.float32, shape=[])

. , , None, .

 x =tf.placeholder(tf.float32, shape=[None, None, None])

, , , .

+5

, , (time_steps ) , , , . :

x = tf.placeholder(tf.int32, [None, max_input_steps])
y = tf.placeholder(tf.int32, [None, nax_output_steps])
0

Source: https://habr.com/ru/post/1655315/


All Articles