ValueError: Dimensions must be equal, but are 49152 and 64 for ‘Attention_0/add' (op: 'Add')





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I want to try to replace the contents of the encode and decoder in this github code (i.e.,in dcrnn_model.py line 83) with the encoder and attention decoder.



These are the code before the encoder-decoder:



    max_diffusion_step = int(model_kwargs.get('max_diffusion_step', 2))
cl_decay_steps = int(model_kwargs.get('cl_decay_steps', 1000))
filter_type = model_kwargs.get('filter_type', 'laplacian')
horizon = int(model_kwargs.get('horizon', 1))
max_grad_norm = float(model_kwargs.get('max_grad_norm', 5.0))
num_nodes = int(model_kwargs.get('num_nodes', 1))
num_rnn_layers = int(model_kwargs.get('num_rnn_layers', 1))
rnn_units = int(model_kwargs.get('rnn_units'))
seq_len = int(model_kwargs.get('seq_len'))
use_curriculum_learning = bool(model_kwargs.get('use_curriculum_learning', False))
input_dim = int(model_kwargs.get('input_dim', 1))
output_dim = int(model_kwargs.get('output_dim', 1))
aux_dim = input_dim - output_dim

# Input (batch_size, timesteps, num_sensor, input_dim)
self._inputs = tf.placeholder(tf.float32, shape=(batch_size, seq_len, num_nodes, input_dim), name='inputs')
# Labels: (batch_size, timesteps, num_sensor, input_dim), same format with input except the temporal dimension.
self._labels = tf.placeholder(tf.float32, shape=(batch_size, horizon, num_nodes, input_dim), name='labels')

# GO_SYMBOL = tf.zeros(shape=(batch_size, num_nodes * input_dim))
GO_SYMBOL = tf.zeros(shape=(batch_size, num_nodes * output_dim))

cell = DCGRUCell(rnn_units, adj_mx, max_diffusion_step=max_diffusion_step, num_nodes=num_nodes,
filter_type=filter_type)

cell_with_projection = DCGRUCell(rnn_units, adj_mx, max_diffusion_step=max_diffusion_step, num_nodes=num_nodes,
num_proj=output_dim, filter_type=filter_type)
encoding_cells = [cell] * num_rnn_layers
decoding_cells = [cell] * (num_rnn_layers - 1) + [cell_with_projection]
encoding_cells = tf.contrib.rnn.MultiRNNCell(encoding_cells, state_is_tuple=True)
decoding_cells = tf.contrib.rnn.MultiRNNCell(decoding_cells, state_is_tuple=True)

global_step = tf.train.get_or_create_global_step()
# Outputs: (batch_size, timesteps, num_nodes, output_dim)
with tf.variable_scope('DCRNN_SEQ'):
inputs = tf.unstack(tf.reshape(self._inputs, (batch_size, seq_len, num_nodes * input_dim)), axis=1)
labels = tf.unstack(
tf.reshape(self._labels[..., :output_dim], (batch_size, horizon, num_nodes * output_dim)), axis=1)
if aux_dim > 0:
aux_info = tf.unstack(self._labels[..., output_dim:], axis=1)
aux_info.insert(0, None)
labels.insert(0, GO_SYMBOL)

def _loop_function(prev, i):
if is_training:
# Return either the model's prediction or the previous ground truth in training.
if use_curriculum_learning:
c = tf.random_uniform((), minval=0, maxval=1.)
threshold = self._compute_sampling_threshold(global_step, cl_decay_steps)
result = tf.cond(tf.less(c, threshold), lambda: labels[i], lambda: prev)
else:
result = labels[i]
else:
# Return the prediction of the model in testing.
result = prev
if False and aux_dim > 0:
result = tf.reshape(result, (batch_size, num_nodes, output_dim))
result = tf.concat([result, aux_info[i]], axis=-1)
result = tf.reshape(result, (batch_size, num_nodes * input_dim))
return result


This is the original code for encoder-decoder:



#DCRNN-encoder-decoder
_, enc_state = tf.contrib.rnn.static_rnn(encoding_cells, inputs, dtype=tf.float32)#encoder
outputs, final_state = legacy_seq2seq.rnn_decoder(labels, enc_state, decoding_cells,
loop_function=_loop_function)#decoder


My code is as follows:



# Encoder and Attention_decoder
encoder_outputs, enc_state = tf.contrib.rnn.static_rnn(encoding_cells, inputs, dtype=tf.float32)#encoder
# First calculate a concatenation of encoder outputs to put attention on.
top_states = [tf.reshape(encoder_outputs,[-1, 1, decoding_cells.output_size])]
attention_states = tf.concat(top_states,1)
outputs, final_state = legacy_seq2seq.attention_decoder(labels, enc_state,attention_states, decoding_cells,loop_function=_loop_function)#attention_decoder


However, such a dimensional bug has occurred:



ValueError: Dimensions must be equal, but are 49152 and 64 for 'Train/DCRNN/DCRNN_SEQ/attention_decoder/Attention_0/add' (op: 'Add') with input shapes: [49152,1,1,207], [64,1,1,207].










share|improve this question

























  • You have to make both shapes the same dimensions as stated by your error. It cannot get any clearer than that. You should try verifying your inputs are correct or converting either shape into the same dimensions of the other shape.

    – ycx
    Jan 3 at 8:06













  • Thank you, I know that it may be that the ‘encoder_outputs’ of the encoder is not equal to the dimensions of the decoder, but I don't know how to find and fix this bug.

    – Wendong Zheng
    Jan 4 at 2:01











  • Have you tried manually changing the dimension of the input shapes with either an image resizer or putting in data that will return you the equal shapes?

    – ycx
    Jan 4 at 2:11











  • This data is time series data rather than image data. The original code in github matches the encoder-decoder dimensions, but I added the attention_states and it doesn't match...

    – Wendong Zheng
    Jan 4 at 2:29











  • What is the first dimension data type? You could possibly add in some filler values in that list to at least get out an output and then further understand the problem from there

    – ycx
    Jan 4 at 2:38


















0















I want to try to replace the contents of the encode and decoder in this github code (i.e.,in dcrnn_model.py line 83) with the encoder and attention decoder.



These are the code before the encoder-decoder:



    max_diffusion_step = int(model_kwargs.get('max_diffusion_step', 2))
cl_decay_steps = int(model_kwargs.get('cl_decay_steps', 1000))
filter_type = model_kwargs.get('filter_type', 'laplacian')
horizon = int(model_kwargs.get('horizon', 1))
max_grad_norm = float(model_kwargs.get('max_grad_norm', 5.0))
num_nodes = int(model_kwargs.get('num_nodes', 1))
num_rnn_layers = int(model_kwargs.get('num_rnn_layers', 1))
rnn_units = int(model_kwargs.get('rnn_units'))
seq_len = int(model_kwargs.get('seq_len'))
use_curriculum_learning = bool(model_kwargs.get('use_curriculum_learning', False))
input_dim = int(model_kwargs.get('input_dim', 1))
output_dim = int(model_kwargs.get('output_dim', 1))
aux_dim = input_dim - output_dim

# Input (batch_size, timesteps, num_sensor, input_dim)
self._inputs = tf.placeholder(tf.float32, shape=(batch_size, seq_len, num_nodes, input_dim), name='inputs')
# Labels: (batch_size, timesteps, num_sensor, input_dim), same format with input except the temporal dimension.
self._labels = tf.placeholder(tf.float32, shape=(batch_size, horizon, num_nodes, input_dim), name='labels')

# GO_SYMBOL = tf.zeros(shape=(batch_size, num_nodes * input_dim))
GO_SYMBOL = tf.zeros(shape=(batch_size, num_nodes * output_dim))

cell = DCGRUCell(rnn_units, adj_mx, max_diffusion_step=max_diffusion_step, num_nodes=num_nodes,
filter_type=filter_type)

cell_with_projection = DCGRUCell(rnn_units, adj_mx, max_diffusion_step=max_diffusion_step, num_nodes=num_nodes,
num_proj=output_dim, filter_type=filter_type)
encoding_cells = [cell] * num_rnn_layers
decoding_cells = [cell] * (num_rnn_layers - 1) + [cell_with_projection]
encoding_cells = tf.contrib.rnn.MultiRNNCell(encoding_cells, state_is_tuple=True)
decoding_cells = tf.contrib.rnn.MultiRNNCell(decoding_cells, state_is_tuple=True)

global_step = tf.train.get_or_create_global_step()
# Outputs: (batch_size, timesteps, num_nodes, output_dim)
with tf.variable_scope('DCRNN_SEQ'):
inputs = tf.unstack(tf.reshape(self._inputs, (batch_size, seq_len, num_nodes * input_dim)), axis=1)
labels = tf.unstack(
tf.reshape(self._labels[..., :output_dim], (batch_size, horizon, num_nodes * output_dim)), axis=1)
if aux_dim > 0:
aux_info = tf.unstack(self._labels[..., output_dim:], axis=1)
aux_info.insert(0, None)
labels.insert(0, GO_SYMBOL)

def _loop_function(prev, i):
if is_training:
# Return either the model's prediction or the previous ground truth in training.
if use_curriculum_learning:
c = tf.random_uniform((), minval=0, maxval=1.)
threshold = self._compute_sampling_threshold(global_step, cl_decay_steps)
result = tf.cond(tf.less(c, threshold), lambda: labels[i], lambda: prev)
else:
result = labels[i]
else:
# Return the prediction of the model in testing.
result = prev
if False and aux_dim > 0:
result = tf.reshape(result, (batch_size, num_nodes, output_dim))
result = tf.concat([result, aux_info[i]], axis=-1)
result = tf.reshape(result, (batch_size, num_nodes * input_dim))
return result


This is the original code for encoder-decoder:



#DCRNN-encoder-decoder
_, enc_state = tf.contrib.rnn.static_rnn(encoding_cells, inputs, dtype=tf.float32)#encoder
outputs, final_state = legacy_seq2seq.rnn_decoder(labels, enc_state, decoding_cells,
loop_function=_loop_function)#decoder


My code is as follows:



# Encoder and Attention_decoder
encoder_outputs, enc_state = tf.contrib.rnn.static_rnn(encoding_cells, inputs, dtype=tf.float32)#encoder
# First calculate a concatenation of encoder outputs to put attention on.
top_states = [tf.reshape(encoder_outputs,[-1, 1, decoding_cells.output_size])]
attention_states = tf.concat(top_states,1)
outputs, final_state = legacy_seq2seq.attention_decoder(labels, enc_state,attention_states, decoding_cells,loop_function=_loop_function)#attention_decoder


However, such a dimensional bug has occurred:



ValueError: Dimensions must be equal, but are 49152 and 64 for 'Train/DCRNN/DCRNN_SEQ/attention_decoder/Attention_0/add' (op: 'Add') with input shapes: [49152,1,1,207], [64,1,1,207].










share|improve this question

























  • You have to make both shapes the same dimensions as stated by your error. It cannot get any clearer than that. You should try verifying your inputs are correct or converting either shape into the same dimensions of the other shape.

    – ycx
    Jan 3 at 8:06













  • Thank you, I know that it may be that the ‘encoder_outputs’ of the encoder is not equal to the dimensions of the decoder, but I don't know how to find and fix this bug.

    – Wendong Zheng
    Jan 4 at 2:01











  • Have you tried manually changing the dimension of the input shapes with either an image resizer or putting in data that will return you the equal shapes?

    – ycx
    Jan 4 at 2:11











  • This data is time series data rather than image data. The original code in github matches the encoder-decoder dimensions, but I added the attention_states and it doesn't match...

    – Wendong Zheng
    Jan 4 at 2:29











  • What is the first dimension data type? You could possibly add in some filler values in that list to at least get out an output and then further understand the problem from there

    – ycx
    Jan 4 at 2:38














0












0








0








I want to try to replace the contents of the encode and decoder in this github code (i.e.,in dcrnn_model.py line 83) with the encoder and attention decoder.



These are the code before the encoder-decoder:



    max_diffusion_step = int(model_kwargs.get('max_diffusion_step', 2))
cl_decay_steps = int(model_kwargs.get('cl_decay_steps', 1000))
filter_type = model_kwargs.get('filter_type', 'laplacian')
horizon = int(model_kwargs.get('horizon', 1))
max_grad_norm = float(model_kwargs.get('max_grad_norm', 5.0))
num_nodes = int(model_kwargs.get('num_nodes', 1))
num_rnn_layers = int(model_kwargs.get('num_rnn_layers', 1))
rnn_units = int(model_kwargs.get('rnn_units'))
seq_len = int(model_kwargs.get('seq_len'))
use_curriculum_learning = bool(model_kwargs.get('use_curriculum_learning', False))
input_dim = int(model_kwargs.get('input_dim', 1))
output_dim = int(model_kwargs.get('output_dim', 1))
aux_dim = input_dim - output_dim

# Input (batch_size, timesteps, num_sensor, input_dim)
self._inputs = tf.placeholder(tf.float32, shape=(batch_size, seq_len, num_nodes, input_dim), name='inputs')
# Labels: (batch_size, timesteps, num_sensor, input_dim), same format with input except the temporal dimension.
self._labels = tf.placeholder(tf.float32, shape=(batch_size, horizon, num_nodes, input_dim), name='labels')

# GO_SYMBOL = tf.zeros(shape=(batch_size, num_nodes * input_dim))
GO_SYMBOL = tf.zeros(shape=(batch_size, num_nodes * output_dim))

cell = DCGRUCell(rnn_units, adj_mx, max_diffusion_step=max_diffusion_step, num_nodes=num_nodes,
filter_type=filter_type)

cell_with_projection = DCGRUCell(rnn_units, adj_mx, max_diffusion_step=max_diffusion_step, num_nodes=num_nodes,
num_proj=output_dim, filter_type=filter_type)
encoding_cells = [cell] * num_rnn_layers
decoding_cells = [cell] * (num_rnn_layers - 1) + [cell_with_projection]
encoding_cells = tf.contrib.rnn.MultiRNNCell(encoding_cells, state_is_tuple=True)
decoding_cells = tf.contrib.rnn.MultiRNNCell(decoding_cells, state_is_tuple=True)

global_step = tf.train.get_or_create_global_step()
# Outputs: (batch_size, timesteps, num_nodes, output_dim)
with tf.variable_scope('DCRNN_SEQ'):
inputs = tf.unstack(tf.reshape(self._inputs, (batch_size, seq_len, num_nodes * input_dim)), axis=1)
labels = tf.unstack(
tf.reshape(self._labels[..., :output_dim], (batch_size, horizon, num_nodes * output_dim)), axis=1)
if aux_dim > 0:
aux_info = tf.unstack(self._labels[..., output_dim:], axis=1)
aux_info.insert(0, None)
labels.insert(0, GO_SYMBOL)

def _loop_function(prev, i):
if is_training:
# Return either the model's prediction or the previous ground truth in training.
if use_curriculum_learning:
c = tf.random_uniform((), minval=0, maxval=1.)
threshold = self._compute_sampling_threshold(global_step, cl_decay_steps)
result = tf.cond(tf.less(c, threshold), lambda: labels[i], lambda: prev)
else:
result = labels[i]
else:
# Return the prediction of the model in testing.
result = prev
if False and aux_dim > 0:
result = tf.reshape(result, (batch_size, num_nodes, output_dim))
result = tf.concat([result, aux_info[i]], axis=-1)
result = tf.reshape(result, (batch_size, num_nodes * input_dim))
return result


This is the original code for encoder-decoder:



#DCRNN-encoder-decoder
_, enc_state = tf.contrib.rnn.static_rnn(encoding_cells, inputs, dtype=tf.float32)#encoder
outputs, final_state = legacy_seq2seq.rnn_decoder(labels, enc_state, decoding_cells,
loop_function=_loop_function)#decoder


My code is as follows:



# Encoder and Attention_decoder
encoder_outputs, enc_state = tf.contrib.rnn.static_rnn(encoding_cells, inputs, dtype=tf.float32)#encoder
# First calculate a concatenation of encoder outputs to put attention on.
top_states = [tf.reshape(encoder_outputs,[-1, 1, decoding_cells.output_size])]
attention_states = tf.concat(top_states,1)
outputs, final_state = legacy_seq2seq.attention_decoder(labels, enc_state,attention_states, decoding_cells,loop_function=_loop_function)#attention_decoder


However, such a dimensional bug has occurred:



ValueError: Dimensions must be equal, but are 49152 and 64 for 'Train/DCRNN/DCRNN_SEQ/attention_decoder/Attention_0/add' (op: 'Add') with input shapes: [49152,1,1,207], [64,1,1,207].










share|improve this question
















I want to try to replace the contents of the encode and decoder in this github code (i.e.,in dcrnn_model.py line 83) with the encoder and attention decoder.



These are the code before the encoder-decoder:



    max_diffusion_step = int(model_kwargs.get('max_diffusion_step', 2))
cl_decay_steps = int(model_kwargs.get('cl_decay_steps', 1000))
filter_type = model_kwargs.get('filter_type', 'laplacian')
horizon = int(model_kwargs.get('horizon', 1))
max_grad_norm = float(model_kwargs.get('max_grad_norm', 5.0))
num_nodes = int(model_kwargs.get('num_nodes', 1))
num_rnn_layers = int(model_kwargs.get('num_rnn_layers', 1))
rnn_units = int(model_kwargs.get('rnn_units'))
seq_len = int(model_kwargs.get('seq_len'))
use_curriculum_learning = bool(model_kwargs.get('use_curriculum_learning', False))
input_dim = int(model_kwargs.get('input_dim', 1))
output_dim = int(model_kwargs.get('output_dim', 1))
aux_dim = input_dim - output_dim

# Input (batch_size, timesteps, num_sensor, input_dim)
self._inputs = tf.placeholder(tf.float32, shape=(batch_size, seq_len, num_nodes, input_dim), name='inputs')
# Labels: (batch_size, timesteps, num_sensor, input_dim), same format with input except the temporal dimension.
self._labels = tf.placeholder(tf.float32, shape=(batch_size, horizon, num_nodes, input_dim), name='labels')

# GO_SYMBOL = tf.zeros(shape=(batch_size, num_nodes * input_dim))
GO_SYMBOL = tf.zeros(shape=(batch_size, num_nodes * output_dim))

cell = DCGRUCell(rnn_units, adj_mx, max_diffusion_step=max_diffusion_step, num_nodes=num_nodes,
filter_type=filter_type)

cell_with_projection = DCGRUCell(rnn_units, adj_mx, max_diffusion_step=max_diffusion_step, num_nodes=num_nodes,
num_proj=output_dim, filter_type=filter_type)
encoding_cells = [cell] * num_rnn_layers
decoding_cells = [cell] * (num_rnn_layers - 1) + [cell_with_projection]
encoding_cells = tf.contrib.rnn.MultiRNNCell(encoding_cells, state_is_tuple=True)
decoding_cells = tf.contrib.rnn.MultiRNNCell(decoding_cells, state_is_tuple=True)

global_step = tf.train.get_or_create_global_step()
# Outputs: (batch_size, timesteps, num_nodes, output_dim)
with tf.variable_scope('DCRNN_SEQ'):
inputs = tf.unstack(tf.reshape(self._inputs, (batch_size, seq_len, num_nodes * input_dim)), axis=1)
labels = tf.unstack(
tf.reshape(self._labels[..., :output_dim], (batch_size, horizon, num_nodes * output_dim)), axis=1)
if aux_dim > 0:
aux_info = tf.unstack(self._labels[..., output_dim:], axis=1)
aux_info.insert(0, None)
labels.insert(0, GO_SYMBOL)

def _loop_function(prev, i):
if is_training:
# Return either the model's prediction or the previous ground truth in training.
if use_curriculum_learning:
c = tf.random_uniform((), minval=0, maxval=1.)
threshold = self._compute_sampling_threshold(global_step, cl_decay_steps)
result = tf.cond(tf.less(c, threshold), lambda: labels[i], lambda: prev)
else:
result = labels[i]
else:
# Return the prediction of the model in testing.
result = prev
if False and aux_dim > 0:
result = tf.reshape(result, (batch_size, num_nodes, output_dim))
result = tf.concat([result, aux_info[i]], axis=-1)
result = tf.reshape(result, (batch_size, num_nodes * input_dim))
return result


This is the original code for encoder-decoder:



#DCRNN-encoder-decoder
_, enc_state = tf.contrib.rnn.static_rnn(encoding_cells, inputs, dtype=tf.float32)#encoder
outputs, final_state = legacy_seq2seq.rnn_decoder(labels, enc_state, decoding_cells,
loop_function=_loop_function)#decoder


My code is as follows:



# Encoder and Attention_decoder
encoder_outputs, enc_state = tf.contrib.rnn.static_rnn(encoding_cells, inputs, dtype=tf.float32)#encoder
# First calculate a concatenation of encoder outputs to put attention on.
top_states = [tf.reshape(encoder_outputs,[-1, 1, decoding_cells.output_size])]
attention_states = tf.concat(top_states,1)
outputs, final_state = legacy_seq2seq.attention_decoder(labels, enc_state,attention_states, decoding_cells,loop_function=_loop_function)#attention_decoder


However, such a dimensional bug has occurred:



ValueError: Dimensions must be equal, but are 49152 and 64 for 'Train/DCRNN/DCRNN_SEQ/attention_decoder/Attention_0/add' (op: 'Add') with input shapes: [49152,1,1,207], [64,1,1,207].







python tensorflow valueerror attention-model encoder-decoder






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 4 at 1:59







Wendong Zheng

















asked Jan 3 at 7:26









Wendong ZhengWendong Zheng

238210




238210













  • You have to make both shapes the same dimensions as stated by your error. It cannot get any clearer than that. You should try verifying your inputs are correct or converting either shape into the same dimensions of the other shape.

    – ycx
    Jan 3 at 8:06













  • Thank you, I know that it may be that the ‘encoder_outputs’ of the encoder is not equal to the dimensions of the decoder, but I don't know how to find and fix this bug.

    – Wendong Zheng
    Jan 4 at 2:01











  • Have you tried manually changing the dimension of the input shapes with either an image resizer or putting in data that will return you the equal shapes?

    – ycx
    Jan 4 at 2:11











  • This data is time series data rather than image data. The original code in github matches the encoder-decoder dimensions, but I added the attention_states and it doesn't match...

    – Wendong Zheng
    Jan 4 at 2:29











  • What is the first dimension data type? You could possibly add in some filler values in that list to at least get out an output and then further understand the problem from there

    – ycx
    Jan 4 at 2:38



















  • You have to make both shapes the same dimensions as stated by your error. It cannot get any clearer than that. You should try verifying your inputs are correct or converting either shape into the same dimensions of the other shape.

    – ycx
    Jan 3 at 8:06













  • Thank you, I know that it may be that the ‘encoder_outputs’ of the encoder is not equal to the dimensions of the decoder, but I don't know how to find and fix this bug.

    – Wendong Zheng
    Jan 4 at 2:01











  • Have you tried manually changing the dimension of the input shapes with either an image resizer or putting in data that will return you the equal shapes?

    – ycx
    Jan 4 at 2:11











  • This data is time series data rather than image data. The original code in github matches the encoder-decoder dimensions, but I added the attention_states and it doesn't match...

    – Wendong Zheng
    Jan 4 at 2:29











  • What is the first dimension data type? You could possibly add in some filler values in that list to at least get out an output and then further understand the problem from there

    – ycx
    Jan 4 at 2:38

















You have to make both shapes the same dimensions as stated by your error. It cannot get any clearer than that. You should try verifying your inputs are correct or converting either shape into the same dimensions of the other shape.

– ycx
Jan 3 at 8:06







You have to make both shapes the same dimensions as stated by your error. It cannot get any clearer than that. You should try verifying your inputs are correct or converting either shape into the same dimensions of the other shape.

– ycx
Jan 3 at 8:06















Thank you, I know that it may be that the ‘encoder_outputs’ of the encoder is not equal to the dimensions of the decoder, but I don't know how to find and fix this bug.

– Wendong Zheng
Jan 4 at 2:01





Thank you, I know that it may be that the ‘encoder_outputs’ of the encoder is not equal to the dimensions of the decoder, but I don't know how to find and fix this bug.

– Wendong Zheng
Jan 4 at 2:01













Have you tried manually changing the dimension of the input shapes with either an image resizer or putting in data that will return you the equal shapes?

– ycx
Jan 4 at 2:11





Have you tried manually changing the dimension of the input shapes with either an image resizer or putting in data that will return you the equal shapes?

– ycx
Jan 4 at 2:11













This data is time series data rather than image data. The original code in github matches the encoder-decoder dimensions, but I added the attention_states and it doesn't match...

– Wendong Zheng
Jan 4 at 2:29





This data is time series data rather than image data. The original code in github matches the encoder-decoder dimensions, but I added the attention_states and it doesn't match...

– Wendong Zheng
Jan 4 at 2:29













What is the first dimension data type? You could possibly add in some filler values in that list to at least get out an output and then further understand the problem from there

– ycx
Jan 4 at 2:38





What is the first dimension data type? You could possibly add in some filler values in that list to at least get out an output and then further understand the problem from there

– ycx
Jan 4 at 2:38












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54018017%2fvalueerror-dimensions-must-be-equal-but-are-49152-and-64-for-attention-0-add%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54018017%2fvalueerror-dimensions-must-be-equal-but-are-49152-and-64-for-attention-0-add%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

Npm cannot find a required file even through it is in the searched directory