Kiểm tra và cộng các tensor
Khi thu thập dữ liệu nhiệt độ, bạn nhận thấy các phép đo lệch 2 độ. Hãy cộng thêm 2 độ vào tensor temperatures sau khi xác minh hình dạng và kiểu dữ liệu của nó bằng torch để đảm bảo tương thích với tensor adjustment.
Thư viện torch và tensor temperatures đã được tải sẵn cho bạn.
Bài tập này là một phần của khóa học
Nhập môn Deep Learning với PyTorch
Bài tập tương tác thực hành trực tiếp
Hãy thử làm bài tập này bằng cách hoàn thành đoạn mã mẫu này.
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)