MulaiMulai sekarang secara gratis

Getting started with PyTorch tensors

Tensors are PyTorch's core data structure and the foundation of deep learning. They're similar to NumPy arrays but have unique features.

Here you have a Python list named temperatures containing daily readings from two weather stations. Try converting this into a tensor!

Latihan ini adalah bagian dari kursus

Introduction to Deep Learning with PyTorch

Lihat Kursus

Petunjuk latihan

  • Begin by importing torch.
  • Create a tensor from the Python list temperatures.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Import PyTorch
____

temperatures = [[72, 75, 78], [70, 73, 76]]

# Create a tensor from temperatures
temp_tensor = torch.____(____)

print(temp_tensor)
Edit dan Jalankan Kode