BaşlayınÜcretsiz Başlayın

Checking and adding tensors

While collecting temperature data, you notice the readings are off by two degrees. Add two degrees to the temperatures tensor after verifying its shape and data type with torch to ensure compatibility with the adjustment tensor.

The torch library and the temperatures tensor are loaded for you.

Bu egzersiz

Introduction to Deep Learning with PyTorch

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

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)
Kodu Düzenle ve Çalıştır