Week 1, second assignment again:
In the text just mentioned the difference between sequential and functional API is one is one input with one out, the latter is multiple input with multiple output.
Now i already see that the output from sequential is with Y_test_shape(150, 1) and functional is (120,6). Am I right?
But why there is multiple input of sequential which is X_train_shape(600,64, 64, 3), why here is not single input? what is it different with functional input (1080, 64, 64, 3)? Only batch size different?
Hi Jingni,
Not sure if I understand your question clearly, one input and one output means one input tensor and one output tensor, (600,64, 64, 3) or (1080, 64, 64, 3) is one tensor though it has multiple dimensions.
Here’s a thread that gives a much more complete introduction to the Sequential and Functional APIs than we get in the notebook. Definitely worth reading through that and I hope it will make things a lot clearer.
2 Likes
A nuance is that the Sequential API supports only a single input object and single output object. Whereas the Functional API supports multiple input objects and output objects but doesn’t require them. That is, you can use either the Sequential or Functional API to define a model with single input and output. If you need multiple, then Functional is your only choice.
Also, note that while the Sequential API limits you to a single input object, that doesn’t imply a single input value as in a scalar. In fact, the input object is a Keras InputLayer that can have a complex input_shape
. So your input shape can be multidimensional, even when using the Sequential API. HTH
1 Like