I get an error at the cell immediately after having imported attention_wrapper
AttributeError: ‘LSTM’ object has no attribute 'get_output_shape_for’
Can someone help in deciphering the cause of this error? Thanks in advance !!
The full trace is as under:
AttributeError Traceback (most recent call last)
in ()
8 x = get_rnn()(x)
9 x = get_rnn()(x)
—> 10 x = Attention(get_rnn, 3)([x, emb_dec])
11 x = TimeDistributed(Dense(output_vocab_size, activation=‘softmax’))(x)
~/py36/lib/python3.6/site-packages/keras/engine/topology.py in call(self, inputs, **kwargs)
592 self.build(input_shapes[0])
593 else:
–> 594 self.build(input_shapes)
595 self.built = True
596
~/Documents/fastai/courses/deeplearning2/attention_wrapper.py in build(self, input_shape)
29 l0 = self.layers[0]
30
—> 31 out_shape = self.get_output_shape_for(input_shape)
32 for layer in self.layers:
33 if not layer.built: layer.build(out_shape)
~/Documents/fastai/courses/deeplearning2/attention_wrapper.py in get_output_shape_for(self, input_shape)
51
52 def get_output_shape_for(self, input_shape):
—> 53 return self.layers[0].get_output_shape_for(input_shape[1])
54
55
AttributeError: ‘LSTM’ object has no attribute ‘get_output_shape_for’