AI Pytorch - freecodecamp.org
< JS C C++ Python >< coding Robotics CNC > < Robotics CNC Links > < CNC >< CNC tutorial > < 3d printing >< Azure MongoDB Spark > < AI Pytorch > < Ship building > < GIT > source: https://www.freecodecamp.org/news/learn-pytorch-for-deep-learning-in-day / Main elements name dimension application tensor Scalar 0 dimension scalar = torch.tensor(7) vector single dimension tensor vector = torch.tensor([7, 7]) can contain many numbers matrix Matrices are as flexible as vectors, except they've got an extra dimension MATRIX = torch.tensor([[7, 8], [9, 10], [6.5, 7.2]]) Tensor tensors can represent almost anything TENSOR = torch.tensor([[[1, 2, 3], [3, 6, 9], [2, 4, 5]]]) Attributes and methods name type example result explanation ndim attribute scalar.ndim 0 checks dimension vector.ndim 1 MATRIX.ndim 2 TENSOR.ndim 3 item method scalar.item() 7 retrieve the number from tensor shape attribute vector.shape torch.Size([2]) How the e