PyTorch Library

  1. Tensors: The Foundation
    1. Understanding Tensors
      1. Mathematical Definition
        1. Relationship to Arrays and Matrices
          1. Role in Deep Learning
            1. Tensor vs NumPy Array Comparison
            2. Tensor Creation
              1. From Python Data Structures
                1. From Lists
                  1. From Nested Lists
                    1. From Tuples
                    2. From NumPy Arrays
                      1. Direct Conversion
                        1. Shared Memory Considerations
                        2. Factory Functions
                          1. torch.tensor()
                            1. torch.Tensor()
                              1. torch.as_tensor()
                                1. torch.from_numpy()
                                2. Initialization with Specific Values
                                  1. torch.zeros()
                                    1. torch.ones()
                                      1. torch.full()
                                        1. torch.eye()
                                          1. torch.empty()
                                          2. Sequential and Range Creation
                                            1. torch.arange()
                                              1. torch.linspace()
                                                1. torch.logspace()
                                                2. Random Tensor Generation
                                                  1. torch.rand()
                                                    1. torch.randn()
                                                      1. torch.randint()
                                                        1. torch.randperm()
                                                        2. Tensor Duplication
                                                          1. torch.clone()
                                                            1. Shallow vs Deep Copying
                                                          2. Tensor Attributes and Properties
                                                            1. Data Type (dtype)
                                                              1. Available Data Types
                                                                1. Type Conversion
                                                                  1. Default Types
                                                                  2. Device Location
                                                                    1. CPU vs GPU Placement
                                                                      1. Device Specification
                                                                      2. Shape and Dimensionality
                                                                        1. Shape Property
                                                                          1. Size Method
                                                                            1. Number of Dimensions
                                                                              1. Number of Elements
                                                                              2. Memory Layout
                                                                                1. Contiguous vs Non-contiguous
                                                                                  1. Strides and Storage
                                                                                  2. Gradient Tracking
                                                                                    1. requires_grad Attribute
                                                                                      1. Gradient Computation Context
                                                                                    2. Tensor Data Types
                                                                                      1. Floating Point Types
                                                                                        1. torch.float32
                                                                                          1. torch.float64
                                                                                            1. torch.float16
                                                                                              1. torch.bfloat16
                                                                                              2. Integer Types
                                                                                                1. torch.int8
                                                                                                  1. torch.int16
                                                                                                    1. torch.int32
                                                                                                      1. torch.int64
                                                                                                        1. torch.uint8
                                                                                                        2. Boolean Type
                                                                                                          1. torch.bool
                                                                                                          2. Complex Types
                                                                                                            1. torch.complex64
                                                                                                              1. torch.complex128
                                                                                                              2. Type Conversion and Casting
                                                                                                                1. Explicit Type Conversion
                                                                                                                  1. Automatic Type Promotion
                                                                                                                2. Device Management
                                                                                                                  1. CPU and GPU Devices
                                                                                                                    1. Device Specification
                                                                                                                      1. Default Device Behavior
                                                                                                                      2. Moving Tensors Between Devices
                                                                                                                        1. to() Method
                                                                                                                          1. cpu() Method
                                                                                                                            1. cuda() Method
                                                                                                                            2. Device-Specific Creation
                                                                                                                              1. Specifying Device at Creation
                                                                                                                                1. Device Context Managers
                                                                                                                                2. Multi-GPU Considerations
                                                                                                                                  1. GPU Selection
                                                                                                                                    1. Memory Management Across Devices