Cannot Create N-Beat Model #213
-
Based on the following code in colab, (in fact I just copy and paste the codes), I can run up to step 6. %%time tf.random.set_seed(42) 1. Setup N-BEATS Block layernbeats_block_layer = NBeatsBlock(input_size=INPUT_SIZE, 2. Create input to stacksstack_input = layers.Input(shape=(INPUT_SIZE), name="stack_input") 3. Create initial backcast and forecast input (backwards predictions are referred to as residuals in the paper)residuals, forecast = nbeats_block_layer(stack_input) Add in subtraction residual link, thank you to: #174residuals = layers.subtract([stack_input, backcast], name=f"subtract_00") 4. Create stacks of blocksfor i, _ in enumerate(range(N_STACKS-1)): # first stack is already creted in (3) 5. Use the NBeatsBlock to calculate the backcast as well as block forecastbackcast, block_forecast = NBeatsBlock( 6. Create the double residual stackingresiduals = layers.subtract([residuals, backcast], name=f"subtract_{i}") 7. Put the stack model togethermodel_7 = tf.keras.Model(inputs=stack_input, If I want to build the model, (step 7), I have the following errors. alueError Traceback (most recent call last) 7 frames in () /usr/local/lib/python3.7/dist-packages/keras/engine/functional.py in _map_graph_network(inputs, outputs) ValueError: Graph disconnected: cannot obtain value for tensor KerasTensor(type_spec=TensorSpec(shape=(None, 7), dtype=tf.float32, name='stack_input'), name='stack_input', description="created by layer 'stack_input'") at layer "subtract_00". The following previous layers were accessed without issue: [] |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @jimmylai-hk, What have you tried to fix it so far? (troubleshooting is a good way to learn how to fix things) I just pushed an update which may have been causing your error, I can confirm the code runs on my end in this notebook: https://github.com/mrdbourke/tensorflow-deep-learning/blob/main/10_time_series_forecasting_in_tensorflow.ipynb |
Beta Was this translation helpful? Give feedback.
Hey @jimmylai-hk,
What have you tried to fix it so far? (troubleshooting is a good way to learn how to fix things)
I just pushed an update which may have been causing your error, I can confirm the code runs on my end in this notebook: https://github.com/mrdbourke/tensorflow-deep-learning/blob/main/10_time_series_forecasting_in_tensorflow.ipynb