back to indexFunctional API - TensorFlow Essentials #2
Chapters
0:0
0:2 Functional Api
1:30 Input Layer
2:42 Densely Connected Neural Network Layers
00:00:00.000 |
Hi, welcome to this video on the Functional API, which 00:00:03.800 |
is the second of the two approaches for building models 00:00:09.200 |
So we're going to go ahead and start our notebook. 00:00:20.360 |
the same architectures as the sequential model, 00:00:23.200 |
plus a few more, thanks to a high level of flexibility. 00:00:32.480 |
different streams of information between layers, 00:00:35.560 |
or anything else that is more complex than a simple linear 00:00:41.960 |
feeding into the next one, and there's nothing fancy going on. 00:00:50.960 |
So you can see at the bottom here, we have two inputs. 00:00:56.440 |
have this stream of data being split into this one layer, 00:01:00.720 |
and then also being fed forward into the next layer as well. 00:01:04.720 |
This is something that you could not do with the sequential 00:01:16.520 |
we instead define the input layers, the network layers, 00:01:21.440 |
which is the same as what we did with the sequential model. 00:01:24.200 |
And then we initialize the model with something 00:01:28.800 |
Let's go ahead and define the input layer first. 00:01:40.200 |
We're going to use a input layer, which is obviously 00:01:50.120 |
to define the input shape, here we are using shape. 00:01:54.760 |
And we're going to build the exact same model 00:01:56.680 |
that we did before, but using the functional model instead. 00:02:08.080 |
into our inputs, which in this case will be industry of 32. 00:02:12.680 |
If we don't define this, it will default to float with 32. 00:02:18.760 |
And then we need to set up our network layers, which 00:02:27.360 |
we can see that we have this sort of network architecture. 00:02:30.880 |
So we have the 10 inputs, which is what we've already 00:02:34.320 |
And then we have our 32 units in the middle here and 2 units 00:02:40.400 |
So we need to build that using densely connected neural 00:02:51.080 |
we are passing the previous layer into our new layer. 00:02:57.200 |
So our previous layer, we have placed into this variable here, 00:03:03.360 |
And we also want to pass it to our new layer here. 00:03:13.240 |
So we're just going to pass it into our new layer here. 00:03:17.440 |
And we're going to pass this new transformation 00:03:30.240 |
they need to have names which are not overwritten 00:03:35.640 |
need to pass those layers into our model initializer 00:03:45.200 |
And then we're going to use the softmax activation here again. 00:04:07.600 |
the variables which define our output and input. 00:04:20.240 |
is because we need them to initialize our model, which 00:04:38.960 |
So this is where, if we did have multiple inputs or outputs, 00:04:45.640 |
So rather than having y, we could have y and y2, 00:05:00.800 |
we get the same output as we did with the sequential model 00:05:06.560 |
So at the top here, rather than saying sequential, 00:05:19.840 |
have a specific definition for the input layer 00:05:23.360 |
as well, which is just because we have actually explicitly 00:05:27.080 |
defined it here rather than it being an input shape to one 00:05:31.880 |
And that is everything for the functional API. 00:05:35.840 |
So I hope that has been useful and I will see you in the next one.