How to use model input in loss function?
问题 I am trying to use a custom loss-function which depends on some arguments that the model does not have. The model has two inputs ( mel_specs and pred_inp ) and expects a labels tensor for training: def to_keras_example(example): # Preparing inputs return (mel_specs, pred_inp), labels # Is a tf.train.Dataset for model.fit(train_data, ...) train_data = load_dataset(fp, 'train).map(to_keras_example).repeat() In my loss function I need to calculate the lengths of mel_specs and pred_inp . This