Course Notes: Introduction to Deep Learning with PyTorch
  • AI Chat
  • Code
  • Report
  • Beta
    Spinner

    Import torch and create tensor

    # Import PyTorch
    import torch
    
    list_a = [1, 2, 3, 4]
    
    # Create a tensor from list_a
    tensor_a = torch.tensor(list_a)
    
    print(tensor_a)