檢查並相加張量
在收集溫度資料時,你發現讀值偏差了 2 度。請在用 torch 驗證 temperatures 張量的形狀與資料型別,確保與 adjustment 張量相容之後,為 temperatures 張量加上 2 度。
torch 函式庫與 temperatures 張量已為你載入。
本練習屬於課程
使用 PyTorch 的深度學習入門
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
adjustment = torch.tensor([[2, 2, 2], [2, 2, 2]])
# Display the shape of the adjustment tensor
print("Adjustment shape:", adjustment.____)
# Display the type of the adjustment tensor
print("Adjustment type:", adjustment.____)
print("Temperatures shape:", temperatures.shape)
print("Temperatures type:", temperatures.dtype)