Tensorflow BahdanauAttention - Layer memory_layer expects 1 inputs, but it received 2 input tensors Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live! Should we burninate the [wrap] tag?tensorfow tf.expand_dims ErrorTensorflow - You must feed a value for placeholder tensor 'X' with dtype floatInvalidArgumentError while coding MNIST tutorialTensorflow seq2seq Decoder problems?while_loop error in TensorflowTensorflow - Casting from complex64 to 2x float32Using Tensorflow Estimator API with Images for SemSegTensorflow compute_output_shape() Not Working For Custom LayerVariable sentence length for LSTM using word2vec as inputs on tensorflowHow to reintroduce (None, ) batch dimension to tensor in Keras / Tensorflow?

Why is "Consequences inflicted." not a sentence?

How to answer "Have you ever been terminated?"

How widely used is the term Treppenwitz? Is it something that most Germans know?

Should I use a zero-interest credit card for a large one-time purchase?

How to run gsettings for another user Ubuntu 18.04.2 LTS

Identify plant with long narrow paired leaves and reddish stems

Can an alien society believe that their star system is the universe?

What does the "x" in "x86" represent?

How to deal with a team lead who never gives me credit?

What is a non-alternating simple group with big order, but relatively few conjugacy classes?

At the end of Thor: Ragnarok why don't the Asgardians turn and head for the Bifrost as per their original plan?

How to bypass password on Windows XP account?

51k Euros annually for a family of 4 in Berlin: Is it enough?

Using et al. for a last / senior author rather than for a first author

How to tell that you are a giant?

ListPlot join points by nearest neighbor rather than order

Denied boarding although I have proper visa and documentation. To whom should I make a complaint?

Overriding an object in memory with placement new

What's the purpose of writing one's academic biography in the third person?

What is the meaning of the new sigil in Game of Thrones Season 8 intro?

How discoverable are IPv6 addresses and AAAA names by potential attackers?

Why is my conclusion inconsistent with the van't Hoff equation?

How come Sam didn't become Lord of Horn Hill?

Is there a (better) way to access $wpdb results?



Tensorflow BahdanauAttention - Layer memory_layer expects 1 inputs, but it received 2 input tensors



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!
Should we burninate the [wrap] tag?tensorfow tf.expand_dims ErrorTensorflow - You must feed a value for placeholder tensor 'X' with dtype floatInvalidArgumentError while coding MNIST tutorialTensorflow seq2seq Decoder problems?while_loop error in TensorflowTensorflow - Casting from complex64 to 2x float32Using Tensorflow Estimator API with Images for SemSegTensorflow compute_output_shape() Not Working For Custom LayerVariable sentence length for LSTM using word2vec as inputs on tensorflowHow to reintroduce (None, ) batch dimension to tensor in Keras / Tensorflow?



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








1
















Tensorflow: 1.12




I am using bidirectional_dynamic_rnn. I wrote encoder_output to BahdanauAttention's memory option (recommended on tensorflow website), but it throws an error:




ValueError: Layer memory_layer expects 1 inputs, but it received 2
input tensors. Inputs received: tf.Tensor
'bidirectional_rnn/fw/fw/transpose_1:0' shape=(?, ?, 512)
dtype=float32, tf.Tensor 'ReverseSequence:0' shape=(?, ?, 512)
dtype=float32]




def model_inputs():
inputs = tf.placeholder(tf.int32, [None, None], name='input')
targets = tf.placeholder(tf.int32, [None, None], name='target')
lr = tf.placeholder(tf.float32, name='learning_rate')
keep_prob = tf.placeholder(tf.float32, name='keep_prob')
return inputs, targets, lr, keep_prob

def preprocess_targets(targets, word2int, batch_size):
left_side = tf.fill([batch_size, 1], word2int['<SOS>'])
right_side = tf.strided_slice(targets, [0,0], [batch_size, -1], [1,1])
preprocessed_targets = tf.concat([left_side, right_side], 1)
return preprocessed_targets

#Encoder RNN
def encoder_rnn(rnn_inputs, rnn_size, num_layers, keep_prob, sequence_lenght):
lstm = tf.contrib.rnn.BasicLSTMCell(rnn_size)
lstm_dropout = tf.contrib.rnn.DropoutWrapper(lstm, input_keep_prob = keep_prob)
encoder_cell = tf.contrib.rnn.MultiRNNCell([lstm_dropout] * num_layers)
global encoder_output, encoder_state
encoder_output, encoder_state = tf.nn.bidirectional_dynamic_rnn(cell_fw = encoder_cell,
cell_bw = encoder_cell,
sequence_length = sequence_length,
inputs = rnn_inputs,
dtype = tf.float32)

return encoder_state



#Decoding training set
def decode_training_set(encoder_state, decoder_cell, decoder_embedded_input, sequence_lenght, decoding_scope, output_function, keep_prob, batch_size):
#attention_states = tf.zeros([batch_size, 1, decoder_cell.output_size])
attention_mechanism = tf.contrib.seq2seq.BahdanauAttention(num_units = decoder_cell.output_size, memory = encoder_output, normalize=False)


What can I do?










share|improve this question
























  • A complete stack trace would probably help to see where the error is coming from.

    – iga
    Mar 9 at 0:38











  • Hi @iga I have edited and that's all. Thanks.

    – Night Fighter
    Mar 9 at 14:28











  • I still don't see the full stack trace that includes all the calls leading to the error.

    – iga
    Mar 11 at 19:46

















1
















Tensorflow: 1.12




I am using bidirectional_dynamic_rnn. I wrote encoder_output to BahdanauAttention's memory option (recommended on tensorflow website), but it throws an error:




ValueError: Layer memory_layer expects 1 inputs, but it received 2
input tensors. Inputs received: tf.Tensor
'bidirectional_rnn/fw/fw/transpose_1:0' shape=(?, ?, 512)
dtype=float32, tf.Tensor 'ReverseSequence:0' shape=(?, ?, 512)
dtype=float32]




def model_inputs():
inputs = tf.placeholder(tf.int32, [None, None], name='input')
targets = tf.placeholder(tf.int32, [None, None], name='target')
lr = tf.placeholder(tf.float32, name='learning_rate')
keep_prob = tf.placeholder(tf.float32, name='keep_prob')
return inputs, targets, lr, keep_prob

def preprocess_targets(targets, word2int, batch_size):
left_side = tf.fill([batch_size, 1], word2int['<SOS>'])
right_side = tf.strided_slice(targets, [0,0], [batch_size, -1], [1,1])
preprocessed_targets = tf.concat([left_side, right_side], 1)
return preprocessed_targets

#Encoder RNN
def encoder_rnn(rnn_inputs, rnn_size, num_layers, keep_prob, sequence_lenght):
lstm = tf.contrib.rnn.BasicLSTMCell(rnn_size)
lstm_dropout = tf.contrib.rnn.DropoutWrapper(lstm, input_keep_prob = keep_prob)
encoder_cell = tf.contrib.rnn.MultiRNNCell([lstm_dropout] * num_layers)
global encoder_output, encoder_state
encoder_output, encoder_state = tf.nn.bidirectional_dynamic_rnn(cell_fw = encoder_cell,
cell_bw = encoder_cell,
sequence_length = sequence_length,
inputs = rnn_inputs,
dtype = tf.float32)

return encoder_state



#Decoding training set
def decode_training_set(encoder_state, decoder_cell, decoder_embedded_input, sequence_lenght, decoding_scope, output_function, keep_prob, batch_size):
#attention_states = tf.zeros([batch_size, 1, decoder_cell.output_size])
attention_mechanism = tf.contrib.seq2seq.BahdanauAttention(num_units = decoder_cell.output_size, memory = encoder_output, normalize=False)


What can I do?










share|improve this question
























  • A complete stack trace would probably help to see where the error is coming from.

    – iga
    Mar 9 at 0:38











  • Hi @iga I have edited and that's all. Thanks.

    – Night Fighter
    Mar 9 at 14:28











  • I still don't see the full stack trace that includes all the calls leading to the error.

    – iga
    Mar 11 at 19:46













1












1








1


1







Tensorflow: 1.12




I am using bidirectional_dynamic_rnn. I wrote encoder_output to BahdanauAttention's memory option (recommended on tensorflow website), but it throws an error:




ValueError: Layer memory_layer expects 1 inputs, but it received 2
input tensors. Inputs received: tf.Tensor
'bidirectional_rnn/fw/fw/transpose_1:0' shape=(?, ?, 512)
dtype=float32, tf.Tensor 'ReverseSequence:0' shape=(?, ?, 512)
dtype=float32]




def model_inputs():
inputs = tf.placeholder(tf.int32, [None, None], name='input')
targets = tf.placeholder(tf.int32, [None, None], name='target')
lr = tf.placeholder(tf.float32, name='learning_rate')
keep_prob = tf.placeholder(tf.float32, name='keep_prob')
return inputs, targets, lr, keep_prob

def preprocess_targets(targets, word2int, batch_size):
left_side = tf.fill([batch_size, 1], word2int['<SOS>'])
right_side = tf.strided_slice(targets, [0,0], [batch_size, -1], [1,1])
preprocessed_targets = tf.concat([left_side, right_side], 1)
return preprocessed_targets

#Encoder RNN
def encoder_rnn(rnn_inputs, rnn_size, num_layers, keep_prob, sequence_lenght):
lstm = tf.contrib.rnn.BasicLSTMCell(rnn_size)
lstm_dropout = tf.contrib.rnn.DropoutWrapper(lstm, input_keep_prob = keep_prob)
encoder_cell = tf.contrib.rnn.MultiRNNCell([lstm_dropout] * num_layers)
global encoder_output, encoder_state
encoder_output, encoder_state = tf.nn.bidirectional_dynamic_rnn(cell_fw = encoder_cell,
cell_bw = encoder_cell,
sequence_length = sequence_length,
inputs = rnn_inputs,
dtype = tf.float32)

return encoder_state



#Decoding training set
def decode_training_set(encoder_state, decoder_cell, decoder_embedded_input, sequence_lenght, decoding_scope, output_function, keep_prob, batch_size):
#attention_states = tf.zeros([batch_size, 1, decoder_cell.output_size])
attention_mechanism = tf.contrib.seq2seq.BahdanauAttention(num_units = decoder_cell.output_size, memory = encoder_output, normalize=False)


What can I do?










share|improve this question

















Tensorflow: 1.12




I am using bidirectional_dynamic_rnn. I wrote encoder_output to BahdanauAttention's memory option (recommended on tensorflow website), but it throws an error:




ValueError: Layer memory_layer expects 1 inputs, but it received 2
input tensors. Inputs received: tf.Tensor
'bidirectional_rnn/fw/fw/transpose_1:0' shape=(?, ?, 512)
dtype=float32, tf.Tensor 'ReverseSequence:0' shape=(?, ?, 512)
dtype=float32]




def model_inputs():
inputs = tf.placeholder(tf.int32, [None, None], name='input')
targets = tf.placeholder(tf.int32, [None, None], name='target')
lr = tf.placeholder(tf.float32, name='learning_rate')
keep_prob = tf.placeholder(tf.float32, name='keep_prob')
return inputs, targets, lr, keep_prob

def preprocess_targets(targets, word2int, batch_size):
left_side = tf.fill([batch_size, 1], word2int['<SOS>'])
right_side = tf.strided_slice(targets, [0,0], [batch_size, -1], [1,1])
preprocessed_targets = tf.concat([left_side, right_side], 1)
return preprocessed_targets

#Encoder RNN
def encoder_rnn(rnn_inputs, rnn_size, num_layers, keep_prob, sequence_lenght):
lstm = tf.contrib.rnn.BasicLSTMCell(rnn_size)
lstm_dropout = tf.contrib.rnn.DropoutWrapper(lstm, input_keep_prob = keep_prob)
encoder_cell = tf.contrib.rnn.MultiRNNCell([lstm_dropout] * num_layers)
global encoder_output, encoder_state
encoder_output, encoder_state = tf.nn.bidirectional_dynamic_rnn(cell_fw = encoder_cell,
cell_bw = encoder_cell,
sequence_length = sequence_length,
inputs = rnn_inputs,
dtype = tf.float32)

return encoder_state



#Decoding training set
def decode_training_set(encoder_state, decoder_cell, decoder_embedded_input, sequence_lenght, decoding_scope, output_function, keep_prob, batch_size):
#attention_states = tf.zeros([batch_size, 1, decoder_cell.output_size])
attention_mechanism = tf.contrib.seq2seq.BahdanauAttention(num_units = decoder_cell.output_size, memory = encoder_output, normalize=False)


What can I do?







python tensorflow artificial-intelligence






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 9 hours ago









Eskapp

1,5971325




1,5971325










asked Mar 8 at 17:22









Night FighterNight Fighter

84




84












  • A complete stack trace would probably help to see where the error is coming from.

    – iga
    Mar 9 at 0:38











  • Hi @iga I have edited and that's all. Thanks.

    – Night Fighter
    Mar 9 at 14:28











  • I still don't see the full stack trace that includes all the calls leading to the error.

    – iga
    Mar 11 at 19:46

















  • A complete stack trace would probably help to see where the error is coming from.

    – iga
    Mar 9 at 0:38











  • Hi @iga I have edited and that's all. Thanks.

    – Night Fighter
    Mar 9 at 14:28











  • I still don't see the full stack trace that includes all the calls leading to the error.

    – iga
    Mar 11 at 19:46
















A complete stack trace would probably help to see where the error is coming from.

– iga
Mar 9 at 0:38





A complete stack trace would probably help to see where the error is coming from.

– iga
Mar 9 at 0:38













Hi @iga I have edited and that's all. Thanks.

– Night Fighter
Mar 9 at 14:28





Hi @iga I have edited and that's all. Thanks.

– Night Fighter
Mar 9 at 14:28













I still don't see the full stack trace that includes all the calls leading to the error.

– iga
Mar 11 at 19:46





I still don't see the full stack trace that includes all the calls leading to the error.

– iga
Mar 11 at 19:46












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%2f55068088%2ftensorflow-bahdanauattention-layer-memory-layer-expects-1-inputs-but-it-recei%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%2f55068088%2ftensorflow-bahdanauattention-layer-memory-layer-expects-1-inputs-but-it-recei%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

AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

Алба-Юлія

Захаров Федір Захарович