Home > Software design >  input number increasing every time train.dataset is called
input number increasing every time train.dataset is called

Time:10-09

My model has multiple inputs and outputs so I'm passing a dictionary to train_dataset:

train_dataset = tf.data.Dataset.from_tensor_slices(
    (
        {"input_17": timetr, "input_18": atr},
        {"ed": wtr, "sd": wbtr},
    )
)
train_dataset = train_dataset.batch(10)

Now, everytime I run the above code block and then run:

history = model.fit(train_dataset,epochs=5,callbacks=[cp_callback],verbose=1,steps_per_epoch= 402)

It will ask to me increment the input number i.e. "input_17" should be "input_19" and "input_18" should be "input_20". I don't know why this is happening , also I'm tired of incrementing the inputs every time I run both these commands. Is there a workaround?

CodePudding user response:

It creates a new incremental name for each run. Previous names are already used, so the suffix will be increased to assign a new name. Try to specify name yourself like:

InputLayer(...,name="input_1")
InputLayer(...,name="input_2")

Then their names will be the same every time you run.

  • Related