pseudo_teetotaler
pseudo_teetotaler

Reputation: 1575

CNTK Sequence 2 Sequence Tutorial : placeholder_variable initialization

I am new to CNTK and was following seq2seq tutorial of CNTK.

Inside the LSTM_layer function, there's following code :

dh = placeholder_variable(shape=(output_dim), dynamic_axes=input.dynamic_axes)
dc = placeholder_variable(shape=(output_dim), dynamic_axes=input.dynamic_axes)
LSTM_cell = LSTM(output_dim)    
f_x_h_c = LSTM_cell(input, (dh, dc))
h_c = f_x_h_c.outputs

Now, in LSTM_Cell(input,(dh,dc)):what's the value for dh and dc?

I don't find them getting initialized anywhere when LSTM_layer function is called.

Upvotes: 1

Views: 238

Answers (1)

Sayan Pathak
Sayan Pathak

Reputation: 870

If you see a few lines below, you will find that the placeholders are replaced. At the time of model creation you may not have all the values needed but know the shape of the data you will need for that function to work. You create placeholders (containers) for those variables. Before executing the function, these values are replaced with variables that hold values to be computed.

    replacements = { dh: h.output, dc: c.output }
    f_x_h_c.replace_placeholders(replacements)

Upvotes: 1

Related Questions