日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人工智能 > pytorch >内容正文

pytorch

吴恩达深度学习课程练习题汇总(第二周)

發布時間:2023/12/31 pytorch 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 吴恩达深度学习课程练习题汇总(第二周) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.What does a neuron compute?(神經元節點計算什么?)
A neuron computes a linear function (z = Wx + b) followed by an activation function(神經元節點先計算線性函數(z = Wx + b),再計算激活。)
2、Which of these is the “Logistic Loss”?(下面哪一個是 Logistic 損失?
損失函數:𝐿(𝑦^(𝑖) , 𝑦(𝑖)) = ?𝑦(𝑖)log 𝑦^(𝑖) ? (1 ? 𝑦(𝑖))log(1 ? 𝑦^(𝑖))
3、Suppose img is a (32,32,3) array, representing a 32x32 image with 3 color channels red, green and blue. How do you reshape this into a column vector?(假設 img 是一個(32,32,3)數組,具有 3 個顏色通道:紅色、綠色和藍色的 32x32 像素的圖像。 如何將其重新轉換為列向量?)

x = img.reshape((32 * 32 * 3, 1))

4、Consider the two following random arrays “a” and “b”:(看一下下面的這兩個隨機數組“a”和“b”:)

a = np.random.randn(2, 3) # a.shape = (2, 3) b = np.random.randn(2, 1) # b.shape = (2, 1) c = a + b c.shape = (2, 3)

5、. Consider the two following random arrays “a” and “b”:(看一下下面的這兩個隨機數組“a”和“b”)

a = np.random.randn(4, 3) # a.shape = (4, 3) b = np.random.randn(3, 2) # b.shape = (3, 2) c = a * b


ab中表示元素乘法,是兩個矩陣之間對應的元素相乘,需要兩個矩陣之間的維數相同
6、Suppose you have 𝒏𝒙 input features per example. Recall that 𝑿 = [𝒙(𝟏), 𝒙(𝟐) … 𝒙(𝒎)]. What is the dimension of X?(假設你的每一個樣本有𝒏𝒙個輸入特征,想一下在 𝑿 = [𝒙(𝟏), 𝒙(𝟐) … 𝒙(𝒎)]中,X 的維度是多少?)
(𝒏𝒙,m)
7、Recall that np.dot(a,b) performs a matrix multiplication on a and b, whereas a*b performs
an element-wise multiplication.(回想一下,np.dot(a,b)在 a 和 b 上執行矩陣乘法,而“a * b”執行元素方式的乘法。)Consider the two following random arrays “a” and “b”:(看一下下面的這兩個隨機數組“a”和“b”:)

a = np.random.randn(12288, 150) # a.shape = (12288, 150) b = np.random.randn(150, 45) # b.shape = (150, 45) c = np.dot(a, b)

請問c的維度是多少?
解答:

import numpy as np a = np.random.randn(12288, 150) # a.shape = (12288, 150) b = np.random.randn(150, 45) # b.shape = (150, 45) c = np.dot(a, b) print(c.shape)


np.dot(a,b)計算的是元素的內積,在線性代數中相當于矩陣的乘法。
8、看一下下面的這個代碼片段:請問要怎么把它們向量化?

# a.shape = (3,4) # b.shape = (4,1) for i in range(3):for j in range(4):c[i][j] = a[i][j] + b[j] c = a + b.T

9、看一下下面的代碼:請問 c 的維度會是多少?

a = np.random.randn(3, 3) b = np.random.randn(3, 1) c = a * b

c.shape = (3, 3)
這里將會使用廣播機制,b 會被復制三次,再使用元素乘法。
10、看一下下面的計算圖,J 輸出是什么:

J = u + v - w
= a * b + a * c - (b + c)
= a * (b + c) - (b + c)
= (a - 1) * (b + c)

總結

以上是生活随笔為你收集整理的吴恩达深度学习课程练习题汇总(第二周)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。