mlech26l / ncps

PyTorch and TensorFlow implementation of NCP, LTC, and CfC wired neural models
https://www.nature.com/articles/s42256-020-00237-3
Apache License 2.0
1.86k stars 297 forks source link

AttributeError: 'FullyConnected' object has no attribute 'sensory_adjacency_matrix' #30

Closed rain-in-night closed 1 year ago

rain-in-night commented 2 years ago

hi,ace! I am very interested in your work and using your LTCcell to model time series. However, the following problems appear in the process of use, may I ask why? I am a beginner and I hope to get your help Here is my code: `

def main(argv):
    wiring = kerasncp.wirings.FullyConnected(8, FLAGS.rnn_units)  # 16 units, 8 motor neurons
    ltc_cell = LTCCell(wiring, FLAGS.emb_dim)

    casflow_inputs = tf.keras.layers.Input(shape=(FLAGS.max_seq, FLAGS.emb_dim))
    bn_casflow_inputs = tf.keras.layers.BatchNormalization()(casflow_inputs)

    gru_2 = tf.keras.layers.Bidirectional(tf.keras.layers.RNN(ltc_cell))(bn_casflow_inputs)

    mlp_1 = tf.keras.layers.Dense(128, activation='relu')(gru_2)
    mlp_2 = tf.keras.layers.Dense(64, activation='relu')(mlp_1)
    outputs = tf.keras.layers.Dense(1)(mlp_2)`

There is a bug in the running: sa

`

mlech26l commented 2 years ago

hi @zengxiang01

Thanks for reporting the bug.

It seems that the bug is caused by the use of an LTC model inside a tf.keras.layers.Bidirectional module. I will be working on a fix.

mlech26l commented 2 years ago

Hi @zengxiang01

I have pushed a potential fix (keras-ncp version 2.0.7). Can you please update to this version and test your code?