[Python] How to reshape a tensor from [B, L, C] to [B, L * C] in tensorflow 1.x?

Discussão em 'Python' iniciado por Stack, Abril 17, 2025.

  1. Stack

    Stack Membro Participativo

    I have a tensor whose shape is [B, L, C]. I need to reshape it to [B, L * C]. I've tried this:

    shape = tf.shape(x)
    item_vec = tf.reshape(x, [shape[0], shape[1] * shape[2]])


    But while I put it into a tf.contrib.layers.fully_connected, it throw out an error:

    ValueError: The last dimension of the inputs to `Dense` should be defined. Found `None`.


    How can I fix that?

    Continue reading...

Compartilhe esta Página