2/ In classic Tensorflow, this just works:
y = tf.layers.dense(x, 10)
It creates a 10-neuron dense layer with appropriate weights and biases. Where do these weights live? In a global somewhere. Convenient but hair-curling for a software developer ! #noglobalvariables
-
এই থ্রেডটি দেখান
-
3/ In Eager mode, you know where your weights are because you have to put them somewhere yourself. My preferred pattern: a basic class. Define your layers in the constructor, line them up according to your preferred architecture in a "predict" function.pic.twitter.com/zhh3qsMraS
১ reply ২ টি পুনঃটুইট ৫টি পছন্দএই থ্রেডটি দেখান -
4/ You need a loss function, comparing what your model makes of the features against a target answer "yt"pic.twitter.com/zqMLv31SLx
১ reply ২ টি পুনঃটুইট ৪টি পছন্দএই থ্রেডটি দেখান -
5/ Tensorflow eager knows how to compute the gradient for this loss, relatively to the implicit weights and biases of your layers. "grads" is now a function of the same parameters as your loss function.pic.twitter.com/134PBH43d9
১ reply ৩ টি পুনঃটুইট ৭টি পছন্দএই থ্রেডটি দেখান -
6/ instantiate your model, pick an optimizer.pic.twitter.com/AyDySSHc6l
১ reply ২ টি পুনঃটুইট ৬টি পছন্দএই থ্রেডটি দেখান -
7/ And finally the training loop. You are passing your model as a parameter to grads so it is pretty obvious what weights and biases are being modified by the training.pic.twitter.com/l2aoPOWFhF
১ reply ২ টি পুনঃটুইট ৪টি পছন্দএই থ্রেডটি দেখান -
8/ To pipe data into your training loop, my_next_batch() can be implemented with vanilla Python or use the http://tf.data .Dataset API which allows training on out of memory datasets. In eager mode, it is very natural to use:pic.twitter.com/ygggQGjizG
১ reply ২ টি পুনঃটুইট ৪টি পছন্দএই থ্রেডটি দেখান -
9/ For power-users, there are alternative functions for computing gradients in eager mode: implicit_value_and_gradients gets the value of the loss at the same time as gradients. The code above can be made slightly more efficient:pic.twitter.com/q2eUvBzQWJ
১ reply ২ টি পুনঃটুইট ৫টি পছন্দএই থ্রেডটি দেখান -
10/ Also, tfe.GradientTape for differentiating any piece of code against any set of variables. Handy if you do not want to wrap your loss into a function and know the list of trainable variables explicitly, as in Keras Models where the list is in model.variables.pic.twitter.com/zs7sXgyrDC
১ reply ২ টি পুনঃটুইট ৩টি পছন্দএই থ্রেডটি দেখান -
11/ The code in a colab notebook for you to play with:https://drive.google.com/file/d/1WjjGLESzzyL2WLRjcpNBCmz1vFwsDNev/view?usp=sharing …
১ reply ৫ টি পুনঃটুইট ২২টি পছন্দএই থ্রেডটি দেখান
12/ And now the really cool part. Here is my model paused during training in a vanilla Python debugger: the values of weights, biases, activations, you name it are now visible. Yay! Eager rocks!pic.twitter.com/LiSTVwCvGy
-
নতুন কথা-বার্তা
-
লোড হতে বেশ কিছুক্ষণ সময় নিচ্ছে।
টুইটার তার ক্ষমতার বাইরে চলে গেছে বা কোনো সাময়িক সমস্যার সম্মুখীন হয়েছে আবার চেষ্টা করুন বা আরও তথ্যের জন্য টুইটারের স্থিতি দেখুন।