farizrahman4u / recurrentshop

Framework for building complex recurrent neural networks with Keras
MIT License
767 stars 218 forks source link

'_OptionalInputPlaceHolder' object has no attribute 'inbound_nodes' #91

Open weilaweila opened 6 years ago

weilaweila commented 6 years ago

model = Seq2Seq(batch_input_shape=(16, 7, 5), hidden_dim=10, output_length=8, output_dim=20, depth=4, peek=True) AttributeError: '_OptionalInputPlaceHolder' object has no attribute 'inbound_nodes'

natank1 commented 6 years ago

Suffered from the same problem

harvcode commented 6 years ago

I get this error even for the Simple RNN demo.

tinglo commented 6 years ago

I got the same problem.

harvcode commented 6 years ago

Confirmed same issue with both Theano and Tensorflow backends.

harvcode commented 6 years ago

When used together with Keras 2.1.0 the issue doesn't occur.

tskoba commented 6 years ago

I found https://github.com/tensorflow/cleverhans/pull/341 may help.

macgaf commented 6 years ago

Pls modify code at line 841~851 in engine.py inbound_nodes -> _inbound_nodes Just as below:


    if num == 1:
        optional_input_placeholder = _to_list(_OptionalInputPlaceHolder()._inbound_nodes[0].output_tensors)[0]
        assert self._is_optional_input_placeholder(optional_input_placeholder)
        return optional_input_placeholder
    else:
        y = []
        for _ in range(num):
            optional_input_placeholder = _to_list(_OptionalInputPlaceHolder()._inbound_nodes[0].output_tensors)[0]
            assert self._is_optional_input_placeholder(optional_input_placeholder)
            y.append(optional_input_placeholder)
        return y
natank1 commented 6 years ago

Yes I already found it out

Thanks!!

On Fri, Feb 2, 2018 at 5:39 AM, macgaf notifications@github.com wrote:

Pls modify code at line 841~851 in engine.py inbound_nodes -> _inbound_nodes Just as below:

if num == 1:
    optional_input_placeholder = _to_list(_OptionalInputPlaceHolder()._inbound_nodes[0].output_tensors)[0]
    assert self._is_optional_input_placeholder(optional_input_placeholder)
    return optional_input_placeholder
else:
    y = []
    for _ in range(num):
        optional_input_placeholder = _to_list(_OptionalInputPlaceHolder()._inbound_nodes[0].output_tensors)[0]
        assert self._is_optional_input_placeholder(optional_input_placeholder)
        y.append(optional_input_placeholder)
    return y

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/farizrahman4u/recurrentshop/issues/91#issuecomment-362476879, or mute the thread https://github.com/notifications/unsubscribe-auth/AH9tZyfT0d3yB0e53jBKMCDi075_08rYks5tQoN-gaJpZM4RijRT .

ETMayberry commented 6 years ago

duplicated by #90

paul-cb commented 6 years ago

I made this change but it still doesn't work.

yasuyukiokubo commented 6 years ago

Have you changed correct engine.py?

deepakkumar1984 commented 6 years ago

I still get the issue with the modified code:

cdhx commented 5 years ago

there are two engine.py,one is in build/lib, the other is in recurentshop,is this two py the same? why my engine 841-851 line are like this ,should i change code as you said? `def get_cell(self, kwargs): return RNNCellFromModel(self.model, kwargs)

def _get_optional_input_placeholder(self, name=None, num=1):
    if name:
        if name not in self._optional_input_placeholders:
            if num > 1:
                self._optional_input_placeholders[name] = [self._get_optional_input_placeholder() for _ in range(num)]
            else:
                self._optional_input_placeholders[name] = self._get_optional_input_placeholder()
        return self._optional_input_placeholders[name]`