1. tensor.mean(),取算術平均值。指定參數可以計算每一行或者 每一列的算術平均數
2. tensor.unsqueeze(i): 在某個維度(從0開始)增加一個維度。squeeze(i)去掉某一維度
3.numpy轉tensor時的Double Tensor 和Float Tensor 不一致:對numpy用astype(np.float32)可以解決
RuntimeError: Expected object of type torch.DoubleTensor but found type torch.FloatTensor for argument #2 'weight'
4.numpy和tensor轉換:
List轉numpy.array:
temp = np.array(list)
numpy.array轉List:
arr = temp.tolist()
5.numpy升降維:https://www.jianshu.com/p/fd526675c7b7
- numpy的升維
將(2,)變成(2,1)
a = np.array([1,2])
b = np.expand_dims(a, axis=1)
a = np.array([[1],[2]])
b = np.squeeze(a)
6.numpy數組拼接:https://blog.csdn.net/c_living/article/details/85264047
a -> 轉成list(a) -> lista.extend(listb) -> a = np.array(lista)
7.numpy數組降維:np.array(a),a.reshape(2000)..
8.RuntimeError: dimension out of range (expected to be in range of [-1, 0], but got 1)
https://blog.csdn.net/qq_40178291/article/details/100183457
---------------------待更新
2.pycharm查看函數:ctrl+鼠標點擊
3.pycharm全項目搜素:ctrl+shift+f
4.