如果 Keras Tensorflow 的 `Model.fit` 的 target/output 是 `None` 会发生什么?

What happens if Keras Tensorflow's `Model.fit`'s target/output is `None`?

我在看这段代码:https://github.com/keras-team/keras/blob/master/examples/variational_autoencoder.py#L198, where Model.fit() is called without an output or target Tensor. At first, I thought the behavior of Model.fit() is to use the input as the output (which would make sense for this autoencoder implementation). But then I looked into the documentation, and that's not what it says: https://www.tensorflow.org/api_docs/python/tf/keras/Model#fit

这意味着当 y 时,目标是 Nonex 应该是某种包含输入和目标的结构。

但很明显,在这个自动编码器实现中,情况并非如此(x 仅包含输入)。有人可以解释一下在这种情况下会发生什么吗?

model.fit 的 Keras 文档中说明如下:

  • y: Numpy array of target (label) data (if the model has a single output), or list of Numpy arrays (if the model has multiple outputs). If output layers in the model are named, you can also pass a dictionary mapping output names to Numpy arrays. y can be None (default) if feeding from framework-native tensors (e.g. TensorFlow data tensors).

现在,请注意在变分自动编码器示例中,模型 vae is a TensorFlow native tensor, since it is given by the output of another model decoder(TensorFlow 原生张量)的参数 outputsinputs 参数是 独立的 vae 的输入。