title
TensorFlow Tutorial 2 - Tensor Basics

description
In this video we go through the most basic and essential tensor operations that really build the foundation to TensorFlow 2.0 and is important to know before moving on to building neural networks which we will start with in the next tutorial! :) Knowledge in Linear Algebra is very important to have an easier time understanding many tensor operations we go through so I would view as a prerequisite. I think if you don't have that then this series by 3Blue1Brown can be helpful: https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab ❤️ Support the channel ❤️ https://www.youtube.com/channel/UCkzW5JSFwvKRjXABI-UTAkQ/join Paid Courses I recommend for learning (affiliate links, no extra cost for you): ⭐ Machine Learning Specialization https://bit.ly/3hjTBBt ⭐ Deep Learning Specialization https://bit.ly/3YcUkoI ⭐ TensorFlow Specialization https://bit.ly/3FmEVK1 📘 MLOps Specialization http://bit.ly/3wibaWy 📘 GAN Specialization https://bit.ly/3FmnZDl 📘 NLP Specialization http://bit.ly/3GXoQuP ✨ Free Resources that are great: NLP: https://web.stanford.edu/class/cs224n/ CV: http://cs231n.stanford.edu/ Deployment: https://fullstackdeeplearning.com/ FastAI: https://www.fast.ai/ 💻 My Deep Learning Setup and Recording Setup: https://www.amazon.com/shop/aladdinpersson GitHub Repository: https://github.com/aladdinpersson/Machine-Learning-Collection ✅ One-Time Donations: Paypal: https://bit.ly/3buoRYH ▶️ You Can Connect with me on: Twitter - https://twitter.com/aladdinpersson LinkedIn - https://www.linkedin.com/in/aladdin-persson-a95384153/ Github - https://github.com/aladdinpersson OUTLINE: 0:00 - Introduction 0:48 - Imports 2:21 - Initialization methods for Tensors 8:34 - Casting to different types 9:36 - Mathematical Operations 15:16 - Indexing a Tensor 19:18 - Reshaping a Tensor 20:40 - Ending words

detail
{'title': 'TensorFlow Tutorial 2 - Tensor Basics', 'heatmap': [{'end': 54.64, 'start': 33.553, 'weight': 0.883}, {'end': 783.01, 'start': 715.601, 'weight': 0.702}, {'end': 877.451, 'start': 853.736, 'weight': 0.736}, {'end': 1090.007, 'start': 1053.025, 'weight': 0.814}, {'end': 1224.629, 'start': 1209.983, 'weight': 0.705}], 'summary': 'This tensorflow tutorial series covers basic tensor operations, initialization, data handling, indexing, and slicing, offering practical examples and methods for gpu handling and error management.', 'chapters': [{'end': 107.297, 'segs': [{'end': 54.64, 'src': 'heatmap', 'start': 0.57, 'weight': 0, 'content': [{'end': 3.352, 'text': "What is going on guys? Hope you're doing awesome.", 'start': 0.57, 'duration': 2.782}, {'end': 9.198, 'text': 'And welcome to tutorial number two, where we learn about the basic tensor operations,', 'start': 3.472, 'duration': 5.726}, {'end': 12.721, 'text': 'which is the fundamental building block of deep learning libraries.', 'start': 9.198, 'duration': 3.523}, {'end': 25.229, 'text': "All right, so let's start with what a tensor is.", 'start': 22.628, 'duration': 2.601}, {'end': 33.273, 'text': 'And from a programming perspective, essentially a tensor is a multidimensional array that has the ability to be run on the GPU.', 'start': 25.469, 'duration': 7.804}, {'end': 40.936, 'text': 'And from a more mathematical perspective, a tensor is a generalization of a scalar vector and matrix.', 'start': 33.553, 'duration': 7.383}, {'end': 47.059, 'text': 'So for example, a vector is a one-dimensional tensor and a matrix is a two-dimensional tensor.', 'start': 41.456, 'duration': 5.603}, {'end': 54.64, 'text': "so, with that said, let's dive in and try to learn some of the basic operations and how we can do them in tensorflow.", 'start': 47.919, 'duration': 6.721}], 'summary': 'Tutorial on basic tensor operations in deep learning.', 'duration': 54.07, 'max_score': 0.57, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U570.jpg'}, {'end': 107.297, 'src': 'embed', 'start': 73.707, 'weight': 2, 'content': [{'end': 83.459, 'text': "So I'm actually going to do import OS and then you can do OS dot, environment or environ whatever.", 'start': 73.707, 'duration': 9.752}, {'end': 90.147, 'text': 'however, you pronounce that TF and then CPP min log level.', 'start': 83.459, 'duration': 6.688}, {'end': 94.653, 'text': 'and you can set this to a string equal to two.', 'start': 91.772, 'duration': 2.881}, {'end': 103.576, 'text': 'So essentially what this will do, it will still bring us error messages, but these information will just be ignored.', 'start': 95.073, 'duration': 8.503}, {'end': 107.297, 'text': "So if we rerun this now, we're just gonna get nothing.", 'start': 103.596, 'duration': 3.701}], 'summary': 'Using import os to set cpp min log level to 2, ignoring error messages.', 'duration': 33.59, 'max_score': 73.707, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U73707.jpg'}], 'start': 0.57, 'title': 'Tensor operations basics in tensorflow', 'summary': 'Introduces basic tensor operations in tensorflow, explaining the concept of tensors as multidimensional arrays, their relationship to gpu, and error handling when running tensorflow on the gpu.', 'chapters': [{'end': 107.297, 'start': 0.57, 'title': 'Tensor operations basics in tensorflow', 'summary': 'Introduces basic tensor operations in tensorflow, explaining the concept of tensors as multidimensional arrays, their relationship to gpu, and how to handle error messages when running tensorflow on the gpu.', 'duration': 106.727, 'highlights': ['Tensors are multidimensional arrays that can be run on the GPU, serving as the fundamental building block of deep learning libraries.', 'A tensor is a generalization of a scalar, vector, and matrix, where a vector is a one-dimensional tensor and a matrix is a two-dimensional tensor.', "Handling error messages when running TensorFlow on the GPU can be achieved by importing OS and setting the 'TF_CPP_MIN_LOG_LEVEL' to a string equal to two, resulting in the suppression of information messages."]}], 'duration': 106.727, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U570.jpg', 'highlights': ['Tensors are multidimensional arrays that can be run on the GPU, serving as the fundamental building block of deep learning libraries.', 'A tensor is a generalization of a scalar, vector, and matrix, where a vector is a one-dimensional tensor and a matrix is a two-dimensional tensor.', "Handling error messages when running TensorFlow on the GPU can be achieved by importing OS and setting the 'TF_CPP_MIN_LOG_LEVEL' to a string equal to two, resulting in the suppression of information messages."]}, {'end': 329.199, 'segs': [{'end': 163.826, 'src': 'embed', 'start': 107.977, 'weight': 0, 'content': [{'end': 113.5, 'text': "So anyways, let's sort of uh start with what we're going to go through.", 'start': 107.977, 'duration': 5.523}, {'end': 115.842, 'text': "so i'm going to have different parts.", 'start': 113.5, 'duration': 2.342}, {'end': 119.364, 'text': "essentially, i'm going to start with initialization of tensors,", 'start': 115.842, 'duration': 3.522}, {'end': 128.529, 'text': 'so different ways we can actually initialize them and then a more mathematical operations we can perform,', 'start': 119.364, 'duration': 9.165}, {'end': 134.513, 'text': 'and then indexing of a tensor and then lastly reshaping a tensor.', 'start': 128.529, 'duration': 5.984}, {'end': 141.558, 'text': "So let's just start with how do we actually create a tensor in um, in TensorFlow?", 'start': 135.976, 'duration': 5.582}, {'end': 147.16, 'text': 'So how we can do that is we can do X equals TF dot constant.', 'start': 141.938, 'duration': 5.222}, {'end': 148.24, 'text': 'All right.', 'start': 147.96, 'duration': 0.28}, {'end': 149.821, 'text': 'And we can just set some value here.', 'start': 148.4, 'duration': 1.421}, {'end': 151.041, 'text': "Let's do, I don't know.", 'start': 149.881, 'duration': 1.16}, {'end': 154.102, 'text': "Let's just do a scaler, which is just a single number.", 'start': 151.061, 'duration': 3.041}, {'end': 157.243, 'text': "Uh, so we're just going to set four and then let's print that.", 'start': 154.122, 'duration': 3.121}, {'end': 163.826, 'text': "So that's just like a tensor of a scalar value.", 'start': 160.563, 'duration': 3.263}], 'summary': 'The transcript covers tensor initialization, mathematical operations, indexing, and reshaping in tensorflow.', 'duration': 55.849, 'max_score': 107.977, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U107977.jpg'}, {'end': 269.909, 'src': 'embed', 'start': 216.531, 'weight': 2, 'content': [{'end': 221.093, 'text': "So let's say we want to create a more a matrix, so a two-dimensional tensor.", 'start': 216.531, 'duration': 4.562}, {'end': 227.516, 'text': 'We can do tf constant and we can do a list and then list inside that list.', 'start': 221.734, 'duration': 5.782}, {'end': 232.419, 'text': 'So we could do something like one, two, three, and then comma another list, four, five, six.', 'start': 227.596, 'duration': 4.823}, {'end': 241.386, 'text': 'and what this would do is it would create a two rows and then each row here has three columns.', 'start': 233.459, 'duration': 7.927}, {'end': 245.109, 'text': 'so this would create a two by three, uh, two by three matrix.', 'start': 241.386, 'duration': 3.723}, {'end': 252.836, 'text': 'so if we print that, we get uh two by three, and similarly here you can also specify the shapes and so on.', 'start': 245.109, 'duration': 7.727}, {'end': 255.819, 'text': 'now you could also, uh.', 'start': 253.977, 'duration': 1.842}, {'end': 260.142, 'text': 'this is, you know more of a manual initialization of the tensor.', 'start': 255.819, 'duration': 4.323}, {'end': 269.909, 'text': 'you could also use other initialization methods, like you could do t x equals tf dot ones and you could specify the shapes.', 'start': 260.142, 'duration': 9.767}], 'summary': 'Demonstrating creation of a 2x3 matrix using tensorflow constant and list initialization.', 'duration': 53.378, 'max_score': 216.531, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U216531.jpg'}, {'end': 329.199, 'src': 'embed', 'start': 289.111, 'weight': 4, 'content': [{'end': 302.697, 'text': "you could do x equals TF dot zeros, and then I don't two by three, and then that would just be a two by three matrix of zeros.", 'start': 289.111, 'duration': 13.586}, {'end': 308.98, 'text': 'and Also there are some other ones like TF dot eyes, and you could do our other eye.', 'start': 302.697, 'duration': 6.283}, {'end': 311.801, 'text': 'So this is a.', 'start': 309.44, 'duration': 2.361}, {'end': 319.483, 'text': 'in linear algebra, you have I for the identity matrix and if you print, pronounce I.', 'start': 311.801, 'duration': 7.682}, {'end': 321.484, 'text': 'that is sort of it sounds like a.', 'start': 319.483, 'duration': 2.001}, {'end': 329.199, 'text': "So that's how you specify a identical matrix.", 'start': 322.909, 'duration': 6.29}], 'summary': 'Using tensorflow to create matrices of zeros and identity matrices in linear algebra.', 'duration': 40.088, 'max_score': 289.111, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U289111.jpg'}], 'start': 107.977, 'title': 'Tensor initialization and operations in tensorflow', 'summary': 'Covers the initialization, mathematical operations, indexing, and reshaping of tensors in tensorflow. it includes creating a tensor using tf.constant with a scalar value of 4. it also covers manual initialization of tensors, specifying shape and data type, and creating matrices using tf.constant, tf.ones, tf.zeros, and tf.eye methods.', 'chapters': [{'end': 163.826, 'start': 107.977, 'title': 'Tensor initialization and operations', 'summary': 'Covers the initialization of tensors, mathematical operations, indexing, and reshaping of tensors in tensorflow, including creating a tensor using tf.constant with a scalar value of 4.', 'duration': 55.849, 'highlights': ['Initialization of tensors covers various methods, mathematical operations, indexing, and reshaping of tensors.', 'Creating a tensor using TF.constant with a scalar value of 4 demonstrates a practical example of tensor initialization.']}, {'end': 329.199, 'start': 164.186, 'title': 'Tensor initialization and specification', 'summary': 'Covers the manual initialization of tensors, including specifying shape and data type, with examples of creating matrices using tf.constant, tf.ones, tf.zeros, and tf.eye methods.', 'duration': 165.013, 'highlights': ['The chapter covers the manual initialization of tensors, including specifying shape and data type, with examples of creating matrices using tf.constant, tf.ones, tf.zeros, and tf.eye methods.', 'Creating a two-dimensional tensor using tf.constant with a list of lists, such as tf.constant([[1, 2, 3], [4, 5, 6]]), results in a two by three matrix.', 'Using tf.ones to initialize a tensor with a specified shape, like tf.ones((3, 3)), creates a three by three matrix filled with ones.', 'Using tf.zeros to initialize a tensor with a specified shape, such as tf.zeros((2, 3)), creates a two by three matrix filled with zeros.', 'The tf.eye method is used to create an identity matrix, where tf.eye(n) produces an n by n identity matrix.']}], 'duration': 221.222, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U107977.jpg', 'highlights': ['Creating a tensor using TF.constant with a scalar value of 4 demonstrates a practical example of tensor initialization.', 'The chapter covers the manual initialization of tensors, including specifying shape and data type, with examples of creating matrices using tf.constant, tf.ones, tf.zeros, and tf.eye methods.', 'Using tf.ones to initialize a tensor with a specified shape, like tf.ones((3, 3)), creates a three by three matrix filled with ones.', 'Using tf.zeros to initialize a tensor with a specified shape, such as tf.zeros((2, 3)), creates a two by three matrix filled with zeros.', 'The tf.eye method is used to create an identity matrix, where tf.eye(n) produces an n by n identity matrix.', 'Creating a two-dimensional tensor using tf.constant with a list of lists, such as tf.constant([[1, 2, 3], [4, 5, 6]]), results in a two by three matrix.', 'Initialization of tensors covers various methods, mathematical operations, indexing, and reshaping of tensors.']}, {'end': 497.366, 'segs': [{'end': 387.817, 'src': 'embed', 'start': 355.154, 'weight': 0, 'content': [{'end': 365.96, 'text': 'So if we, for example, want to have from a uniform distribution, we could do x equals, tf.random.normal,', 'start': 355.154, 'duration': 10.806}, {'end': 369.242, 'text': 'and we can specify the shapes as the first input tuple.', 'start': 365.96, 'duration': 3.282}, {'end': 371.043, 'text': "And let's say we just want a 3x3 matrix.", 'start': 369.783, 'duration': 1.26}, {'end': 380.611, 'text': "And then we could do, and of course you could do more dimensions here, right? I'm just doing a matrix just for convenience.", 'start': 373.005, 'duration': 7.606}, {'end': 387.817, 'text': 'And then we could do mean equals zero, standard deviation equals one.', 'start': 382.152, 'duration': 5.665}], 'summary': 'Generating a 3x3 matrix from a uniform distribution with mean=0 and std=1.', 'duration': 32.663, 'max_score': 355.154, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U355154.jpg'}, {'end': 478.973, 'src': 'embed', 'start': 449.717, 'weight': 1, 'content': [{'end': 458.922, 'text': 'If you do tf.range of nine, for example, and we print that, we would obtain a vector of a zero, one, and then up to eight.', 'start': 449.717, 'duration': 9.205}, {'end': 462.644, 'text': 'So non-inclusive the nine, exactly the same as Python.', 'start': 459.042, 'duration': 3.602}, {'end': 471.049, 'text': "and if you want to specify more, you could do a start equals, let's say one, and then limit equals.", 'start': 463.204, 'duration': 7.845}, {'end': 471.809, 'text': "um, i don't know.", 'start': 471.049, 'duration': 0.76}, {'end': 475.311, 'text': "let's say 10 and then we could also specify the delta.", 'start': 471.809, 'duration': 3.502}, {'end': 478.973, 'text': 'so delta in this case is, uh, step.', 'start': 475.311, 'duration': 3.662}], 'summary': 'Using tf.range with start=1, limit=10, and delta=1 creates a vector from 1 to 9.', 'duration': 29.256, 'max_score': 449.717, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U449717.jpg'}], 'start': 329.799, 'title': 'Tensorflow initialization methods', 'summary': 'Covers various initialization methods in tensorflow, offering flexibility in matrix initialization through creating matrices from normal and uniform distributions, using the tf.range function, and specifying start, limit, and delta values.', 'chapters': [{'end': 497.366, 'start': 329.799, 'title': 'Tensorflow initialization methods', 'summary': 'Covers various initialization methods in tensorflow, including creating matrices from normal and uniform distributions, using the tf.range function, and specifying start, limit, and delta values, offering flexibility in matrix initialization.', 'duration': 167.567, 'highlights': ['Creating matrices from normal and uniform distributions TensorFlow provides methods for generating matrices from normal and uniform distributions, offering flexibility in initializing matrices for various applications.', 'Using the tf.range function with start, limit, and delta values The tf.range function in TensorFlow allows for the creation of sequences with specified start, limit, and delta values, providing flexibility in generating sequences for different purposes.', 'Specifying start, limit, and delta values for tf.range function The tf.range function in TensorFlow allows for the specification of start, limit, and delta values, offering fine control over the generation of sequences for diverse applications.']}], 'duration': 167.567, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U329799.jpg', 'highlights': ['Creating matrices from normal and uniform distributions TensorFlow provides methods for generating matrices from normal and uniform distributions, offering flexibility in initializing matrices for various applications.', 'Using the tf.range function with start, limit, and delta values The tf.range function in TensorFlow allows for the creation of sequences with specified start, limit, and delta values, providing flexibility in generating sequences for different purposes.', 'Specifying start, limit, and delta values for tf.range function The tf.range function in TensorFlow allows for the specification of start, limit, and delta values, offering fine control over the generation of sequences for diverse applications.']}, {'end': 895.405, 'segs': [{'end': 583.407, 'src': 'embed', 'start': 521.107, 'weight': 0, 'content': [{'end': 526.554, 'text': "So for example, let's say we want flow 64, which is quite uncommon in deep learning.", 'start': 521.107, 'duration': 5.447}, {'end': 529.497, 'text': 'All right, we need to print it as well.', 'start': 528.075, 'duration': 1.422}, {'end': 535.1, 'text': 'so normally you would have float32 or even float16.', 'start': 530.157, 'duration': 4.943}, {'end': 537.121, 'text': 'so float64 is quite uncommon.', 'start': 535.1, 'duration': 2.021}, {'end': 543.043, 'text': "but using cast that's really a way to convert between different types.", 'start': 537.121, 'duration': 5.922}, {'end': 547.946, 'text': "so, for example, let's say we um, We wanted float.", 'start': 543.043, 'duration': 4.903}, {'end': 550.548, 'text': 'We would do tf.float as we did.', 'start': 548.106, 'duration': 2.442}, {'end': 554.13, 'text': 'And then we would just specify sort of which bit we want.', 'start': 550.908, 'duration': 3.222}, {'end': 556.651, 'text': 'So 16, 32, 64.', 'start': 554.33, 'duration': 2.321}, {'end': 558.233, 'text': 'You could also do tf.int.', 'start': 556.652, 'duration': 1.581}, {'end': 565.196, 'text': 'And you could have, you know, 8, 16, 34, 64.', 'start': 558.673, 'duration': 6.523}, {'end': 572.202, 'text': 'And then you also have tf.bool for Boolean making it into 0 and 1.', 'start': 565.198, 'duration': 7.004}, {'end': 575.865, 'text': 'So those are just some ways to cast to different dtypes.', 'start': 572.202, 'duration': 3.663}, {'end': 579.246, 'text': "All right, so let's move on to mathematical operations.", 'start': 576.865, 'duration': 2.381}, {'end': 583.407, 'text': "And let's just create two vectors first.", 'start': 579.446, 'duration': 3.961}], 'summary': 'The transcript covers data type conversion and mathematical operations in tensorflow, including the uncommon use of flow 64 in deep learning.', 'duration': 62.3, 'max_score': 521.107, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U521107.jpg'}, {'end': 783.01, 'src': 'heatmap', 'start': 691.183, 'weight': 3, 'content': [{'end': 697.086, 'text': 'this would also do element wise division and for element wise multiplication.', 'start': 691.183, 'duration': 5.903}, {'end': 710.256, 'text': 'we could do tf, dot, multiply x and y, but we could also do x and then just star or yeah, so X, star, Y.', 'start': 697.086, 'duration': 13.17}, {'end': 715.42, 'text': "And then let's say we wanted to take a dot product.", 'start': 710.256, 'duration': 5.164}, {'end': 722.466, 'text': 'So a dot product in this case would do one times nine plus two times eight plus three times seven.', 'start': 715.601, 'duration': 6.865}, {'end': 723.587, 'text': 'So it would add them up.', 'start': 722.626, 'duration': 0.961}, {'end': 726.39, 'text': 'well, it would element wise.', 'start': 724.728, 'duration': 1.662}, {'end': 729.912, 'text': 'so it would do a element wise multiplication and then a summation.', 'start': 726.39, 'duration': 3.522}, {'end': 736.378, 'text': 'you can do tf, dot, tensor dot, and this is a bit more of an advanced function.', 'start': 729.912, 'duration': 6.466}, {'end': 743.263, 'text': 'it can be used for more things, but in this case we would do x and y and then specify the axis, in this case one.', 'start': 736.378, 'duration': 6.885}, {'end': 751.25, 'text': 'And if we now print that, that would essentially do a element-wise multiplication of the elements and then a summation.', 'start': 744.424, 'duration': 6.826}, {'end': 764.842, 'text': 'So, for example, if we wanted to do this sort of by hand, I guess we would do x times y and then we would do tf.reducesum,', 'start': 751.611, 'duration': 13.231}, {'end': 769.026, 'text': 'and then we would specify the dimension of where we should add them.', 'start': 764.842, 'duration': 4.184}, {'end': 771.807, 'text': 'So axis equals zero.', 'start': 769.566, 'duration': 2.241}, {'end': 776.228, 'text': 'Then we could do print z.', 'start': 772.987, 'duration': 3.241}, {'end': 778.229, 'text': 'And in this way, we obtain the same result.', 'start': 776.228, 'duration': 2.001}, {'end': 783.01, 'text': "And I'm not really sure why it's called reduce sum rather than just tf.sum.", 'start': 778.769, 'duration': 4.241}], 'summary': 'The transcript covers element-wise operations, dot products, and tensor dot in tensorflow.', 'duration': 35.207, 'max_score': 691.183, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U691183.jpg'}, {'end': 844.809, 'src': 'embed', 'start': 816.854, 'weight': 2, 'content': [{'end': 819.915, 'text': 'And then I want to show you how to do matrix multiplication.', 'start': 816.854, 'duration': 3.061}, {'end': 832.599, 'text': "So if we specify, let's say TF random dot normal, and then we do a two by three matrix and then wise TF random normal, and then three by four.", 'start': 819.975, 'duration': 12.624}, {'end': 842.887, 'text': 'So we could do Z equals TF dot matrix multiply in math mole and then specify just X and Y.', 'start': 833.579, 'duration': 9.308}, {'end': 844.809, 'text': 'We can also do this a bit more convenient.', 'start': 842.887, 'duration': 1.922}], 'summary': 'Demonstrating matrix multiplication using tensorflow with specific matrix dimensions.', 'duration': 27.955, 'max_score': 816.854, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U816854.jpg'}, {'end': 880.853, 'src': 'heatmap', 'start': 853.736, 'weight': 0.736, 'content': [{'end': 859.56, 'text': "X at Y and then we would, um, we let's, let's do print set on both of those.", 'start': 853.736, 'duration': 5.824}, {'end': 863.782, 'text': 'So before we run this, uh, I just want to add two lines at the top here.', 'start': 859.82, 'duration': 3.962}, {'end': 867.824, 'text': "Um, We're going to do physical devices.", 'start': 863.802, 'duration': 4.022}, {'end': 877.451, 'text': "We're going to get our GPU and then we're going to do TF config experimental set memory growth of I just have one GPU.", 'start': 867.924, 'duration': 9.527}, {'end': 880.853, 'text': 'So physical devices of zero and then set that to true.', 'start': 877.751, 'duration': 3.102}], 'summary': 'Configuring physical devices for gpu with tf config set memory growth.', 'duration': 27.117, 'max_score': 853.736, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U853736.jpg'}], 'start': 497.787, 'title': 'Tensorflow data and operations', 'summary': 'Covers data type conversion using tf.cast for float32, float16, float64, tf.int, and tf.bool, and introduces mathematical operations. it also explains element-wise operations, matrix multiplication, and their practical usage in tensorflow.', 'chapters': [{'end': 583.407, 'start': 497.787, 'title': 'Tensorflow data type conversion and mathematical operations', 'summary': 'Covers data type conversion in tensorflow using tf.cast to convert between different types such as float32, float16, and float64, as well as tf.int and tf.bool, followed by an introduction to mathematical operations.', 'duration': 85.62, 'highlights': ['The chapter covers data type conversion in TensorFlow using tf.cast to convert between different types such as float32, float16, and float64, as well as tf.int and tf.bool.', 'tf.cast is used to convert between different data types in TensorFlow, such as float32, float16, and float64, for example, and also tf.int and tf.bool.', 'Examples of data type conversion include using tf.float to specify the bit size (16, 32, 64) and tf.int for different integer sizes (8, 16, 32, 64), as well as tf.bool for Boolean conversion.', 'Introduction to mathematical operations in TensorFlow and creating two vectors for further operations.']}, {'end': 895.405, 'start': 583.427, 'title': 'Tensorflow operations and functions', 'summary': 'Covers various element-wise operations and matrix multiplication in tensorflow, including addition, subtraction, division, multiplication, exponentiation, and matrix multiplication, demonstrating their equivalence and practical usage.', 'duration': 311.978, 'highlights': ['The chapter covers various element-wise operations and matrix multiplication in TensorFlow, including addition, subtraction, division, multiplication, exponentiation, and matrix multiplication. Demonstrates the range of operations and functions covered in the chapter.', 'Easier and convenient ways of performing element-wise addition, subtraction, and division are shown, highlighting equivalent methods and practical preferences. Illustrates the different methods for performing these operations in TensorFlow and the convenience of choosing one over the other.', 'Explanation and demonstration of both traditional and more convenient ways of performing element-wise multiplication and dot product, showcasing their practical application. Provides insights into the traditional and more convenient methods for element-wise multiplication and dot product, with practical examples.', 'Demonstration of using TensorFlow functions for matrix multiplication, emphasizing practical usage and convenience. Illustrates the usage of TensorFlow functions for matrix multiplication, highlighting practical convenience and demonstration.', 'Guidance on managing GPU memory allocation to avoid errors and ensure smooth TensorFlow operation. Provides guidance on managing GPU memory allocation to prevent errors and ensure smooth operation of TensorFlow.']}], 'duration': 397.618, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U497787.jpg', 'highlights': ['Covers data type conversion using tf.cast for float32, float16, float64, tf.int, and tf.bool.', 'Introduction to mathematical operations in TensorFlow and creating two vectors for further operations.', 'Demonstration of using TensorFlow functions for matrix multiplication, emphasizing practical usage and convenience.', 'Easier and convenient ways of performing element-wise addition, subtraction, and division are shown, highlighting equivalent methods and practical preferences.']}, {'end': 1036.836, 'segs': [{'end': 929.363, 'src': 'embed', 'start': 896.045, 'weight': 0, 'content': [{'end': 899.008, 'text': "But if you don't have a problem, you shouldn't need to add those.", 'start': 896.045, 'duration': 2.963}, {'end': 902.191, 'text': "But anyways, let's go back to printing this.", 'start': 899.769, 'duration': 2.422}, {'end': 912.861, 'text': 'So if we see now, these are equivalent, right? So you could do either MathMul or just using the add sign.', 'start': 905.014, 'duration': 7.847}, {'end': 917.05, 'text': "All right, so let's move on to indexing of a tensor.", 'start': 914.346, 'duration': 2.704}, {'end': 929.363, 'text': "Let's say we do something like XTF constant, and then, I don't know, just a vector with some values, 0, 1, 1, 2, 3, 1, 2, 3.", 'start': 918.111, 'duration': 11.252}], 'summary': 'Comparison between mathmul and add sign for equivalent operations in tensor indexing.', 'duration': 33.318, 'max_score': 896.045, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U896045.jpg'}, {'end': 1036.836, 'src': 'embed', 'start': 987.51, 'weight': 1, 'content': [{'end': 990.511, 'text': 'So we would just obtain this vector of two elements.', 'start': 987.51, 'duration': 3.001}, {'end': 994.075, 'text': "Then let's also say that we let's say we want all of the values.", 'start': 990.791, 'duration': 3.284}, {'end': 1000.562, 'text': 'So we want all the values, but we want to skip every other element.', 'start': 995.756, 'duration': 4.806}, {'end': 1008.19, 'text': 'So, for example, we want this value, we want to skip the next and we want this value, skip the next and so on.', 'start': 1000.802, 'duration': 7.388}, {'end': 1011.172, 'text': 'How we could do that is we could do colon colon two.', 'start': 1008.73, 'duration': 2.442}, {'end': 1015.036, 'text': 'And this would skip every other element, we would obtain 0132.', 'start': 1011.733, 'duration': 3.303}, {'end': 1018.359, 'text': "And then I don't know.", 'start': 1015.036, 'duration': 3.323}, {'end': 1021.321, 'text': "let's say we wanted to print this in a reverse order.", 'start': 1018.359, 'duration': 2.962}, {'end': 1024.984, 'text': 'we could do x and then colon colon minus one.', 'start': 1021.321, 'duration': 3.663}, {'end': 1027.327, 'text': 'this would print it in the reverse order.', 'start': 1024.984, 'duration': 2.343}, {'end': 1032.292, 'text': "I'm just going to comment that so it doesn't print all the time.", 'start': 1028.207, 'duration': 4.085}, {'end': 1036.836, 'text': "And I guess also, let's say we just want to specify the indices.", 'start': 1032.752, 'duration': 4.084}], 'summary': 'Demonstrating vector manipulation with python using slicing and reverse order.', 'duration': 49.326, 'max_score': 987.51, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U987510.jpg'}], 'start': 896.045, 'title': 'Tensor indexing and slicing', 'summary': 'Covers techniques for tensor indexing and slicing, including excluding elements, obtaining specific elements, skipping elements, and reversing order.', 'chapters': [{'end': 1036.836, 'start': 896.045, 'title': 'Tensor indexing and slicing', 'summary': 'Covers tensor indexing and slicing, demonstrating various techniques such as excluding elements, obtaining specific elements, skipping elements, and reversing order.', 'duration': 140.791, 'highlights': ['Demonstrated indexing of a tensor to exclude the first element, obtaining a specific set of elements, and skipping every other element, providing clear examples of tensor manipulation techniques.', 'Explained the method to print the tensor in a reverse order, showcasing the versatility of tensor manipulation and providing a comprehensive understanding of tensor operations.', 'Discussed the various methods of tensor indexing and slicing, including excluding elements, obtaining specific elements, skipping elements, and reversing order, providing a holistic overview of tensor manipulation techniques.']}], 'duration': 140.791, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U896045.jpg', 'highlights': ['Discussed the various methods of tensor indexing and slicing, including excluding elements, obtaining specific elements, skipping elements, and reversing order, providing a holistic overview of tensor manipulation techniques.', 'Demonstrated indexing of a tensor to exclude the first element, obtaining a specific set of elements, and skipping every other element, providing clear examples of tensor manipulation techniques.', 'Explained the method to print the tensor in a reverse order, showcasing the versatility of tensor manipulation and providing a comprehensive understanding of tensor operations.']}, {'end': 1252.431, 'segs': [{'end': 1127.971, 'src': 'heatmap', 'start': 1053.025, 'weight': 1, 'content': [{'end': 1065.166, 'text': "And then we could use, we could do say let's call it X end and then TF dot gather from X from the tensor X.", 'start': 1053.025, 'duration': 12.141}, {'end': 1068.289, 'text': 'We want to gather the specific in this as zero and three.', 'start': 1065.166, 'duration': 3.123}, {'end': 1076.916, 'text': 'So if we print X end, we would now obtain a zero and two, those values that we want to extract.', 'start': 1068.809, 'duration': 8.107}, {'end': 1078.636, 'text': 'All right.', 'start': 1078.416, 'duration': 0.22}, {'end': 1079.937, 'text': 'So this is just for a vector.', 'start': 1078.656, 'duration': 1.281}, {'end': 1082.34, 'text': "Let's take a more, let's take a matrix.", 'start': 1079.978, 'duration': 2.362}, {'end': 1090.007, 'text': "So let's do X equals TF constant, and then let's do one and two, um, three and four.", 'start': 1082.36, 'duration': 7.647}, {'end': 1092.193, 'text': 'five and six.', 'start': 1091.573, 'duration': 0.62}, {'end': 1097.756, 'text': 'So this would be a three by two dimensional matrix.', 'start': 1093.034, 'duration': 4.722}, {'end': 1109.981, 'text': "And then let's say we want to to get just the the first row with all of the elements, how we could do that is we could do x and then zero.", 'start': 1098.376, 'duration': 11.605}, {'end': 1116.664, 'text': 'we could also do this by doing x comma and then all all right.', 'start': 1111.161, 'duration': 5.503}, {'end': 1125.81, 'text': 'so when we add multiple dimensions of our tensor, we separate the the dimensions by a comma And, similarly to how we did in a vector,', 'start': 1116.664, 'duration': 9.146}, {'end': 1127.971, 'text': 'we can specify the ones we want.', 'start': 1125.81, 'duration': 2.161}], 'summary': 'Using tensorflow to extract specific values from tensors, including vectors and matrices.', 'duration': 59.162, 'max_score': 1053.025, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U1053025.jpg'}, {'end': 1183.769, 'src': 'embed', 'start': 1154.828, 'weight': 4, 'content': [{'end': 1160.132, 'text': "Let's remove those print statements and let's now move to some just basic reshaping.", 'start': 1154.828, 'duration': 5.304}, {'end': 1166.297, 'text': "So let's say we have X is TF range of nine.", 'start': 1160.573, 'duration': 5.724}, {'end': 1170.96, 'text': 'So we would have nine elements and we want to reshape this.', 'start': 1166.917, 'duration': 4.043}, {'end': 1173.342, 'text': "So let's do print X.", 'start': 1171.221, 'duration': 2.121}, {'end': 1176.665, 'text': "Let's say we want to reshape this into a three by three matrix.", 'start': 1173.342, 'duration': 3.323}, {'end': 1183.769, 'text': 'then we could do x equals tf, dot, reshape x, and then we specify the dimensions.', 'start': 1177.785, 'duration': 5.984}], 'summary': 'Remove print statements and reshape x into a 3x3 matrix using tensorflow.', 'duration': 28.941, 'max_score': 1154.828, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U1154828.jpg'}, {'end': 1237.894, 'src': 'heatmap', 'start': 1209.983, 'weight': 0.705, 'content': [{'end': 1214.045, 'text': 'And then we could also specify perm for permutation.', 'start': 1209.983, 'duration': 4.062}, {'end': 1219.567, 'text': 'And this works for multiple dimensions as well, not just for two dimensions as we have here.', 'start': 1214.885, 'duration': 4.682}, {'end': 1224.629, 'text': 'You could specify in this case 1, 0, rather 1, 0.', 'start': 1220.087, 'duration': 4.542}, {'end': 1227.03, 'text': 'So this would just swap the axis.', 'start': 1224.629, 'duration': 2.401}, {'end': 1237.894, 'text': 'So if we now print x, we then obtain this first row as our first column, right? And the second row is now our second column right here.', 'start': 1227.57, 'duration': 10.324}], 'summary': 'Demonstrating axis swapping using perm for permutation in multiple dimensions.', 'duration': 27.911, 'max_score': 1209.983, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U1209983.jpg'}, {'end': 1252.431, 'src': 'embed', 'start': 1241.835, 'weight': 0, 'content': [{'end': 1245.12, 'text': "So that's it for the basics of tensor operations.", 'start': 1241.835, 'duration': 3.285}, {'end': 1252.431, 'text': 'Thank you so much for watching the video and in the next video we will start with building some basic neural networks.', 'start': 1245.801, 'duration': 6.63}], 'summary': 'Introduction to tensor operations. next: building basic neural networks.', 'duration': 10.596, 'max_score': 1241.835, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U1241835.jpg'}], 'start': 1036.856, 'title': 'Tensorflow basics', 'summary': 'Covers tensorflow basics including data extraction, tensor indexing, and tensor operations, with examples of extracting values from vectors and matrices, selecting specific rows and elements, reshaping arrays, and transposing matrices.', 'chapters': [{'end': 1097.756, 'start': 1036.856, 'title': 'Tensorflow data extraction', 'summary': 'Discusses using tensorflow to extract specific values from a vector and a matrix using indices and gather function, with examples of extracting zero and two from a vector and three and six from a matrix.', 'duration': 60.9, 'highlights': ['Using TensorFlow to extract specific values from a matrix by defining the indices and using the gather function, as demonstrated with a three by two dimensional matrix.', 'Extracting specific values from a vector using TensorFlow by specifying the indices and using the gather function, illustrated with the extraction of zero and two.']}, {'end': 1154.588, 'start': 1098.376, 'title': 'Tensor indexing basics', 'summary': 'Explains basic tensor indexing, including selecting specific rows and elements, using comma to separate dimensions, and obtaining a specified matrix.', 'duration': 56.212, 'highlights': ['We can select the first row with all elements by using x[0,:] or x[0, :].', 'To pick out the first two rows, we can use x[0:2, :].', 'When adding multiple dimensions to a tensor, the dimensions are separated by a comma.']}, {'end': 1252.431, 'start': 1154.828, 'title': 'Tensor operations basics', 'summary': 'Covers basic tensor operations including reshaping, transposing, and permutation using tensorflow, with an example of reshaping a 1d array into a 3x3 matrix and transposing it, concluding with a preview of the next video on building neural networks.', 'duration': 97.603, 'highlights': ['The basics of tensor operations include reshaping, transposing, and permutation using TensorFlow.', 'An example of reshaping a 1D array into a 3x3 matrix is demonstrated, with the resulting matrix printed.', 'Transposing a matrix is illustrated, with the method tf.transpose() and the concept of permutation explained.', 'The tutorial concludes with a preview of the next video on building basic neural networks.']}], 'duration': 215.575, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HPjBY1H-U4U/pics/HPjBY1H-U4U1036856.jpg', 'highlights': ['Covers tensorflow basics including data extraction, tensor indexing, and operations', 'Extracting specific values from a matrix and vector using TensorFlow', 'Selecting specific rows and elements from a tensor', 'Basics of tensor operations: reshaping, transposing, and permutation', 'Demonstrates reshaping a 1D array into a 3x3 matrix and transposing a matrix', 'Introduction to building basic neural networks']}], 'highlights': ['Tensors are multidimensional arrays that can be run on the GPU, serving as the fundamental building block of deep learning libraries.', 'A tensor is a generalization of a scalar, vector, and matrix, where a vector is a one-dimensional tensor and a matrix is a two-dimensional tensor.', "Handling error messages when running TensorFlow on the GPU can be achieved by importing OS and setting the 'TF_CPP_MIN_LOG_LEVEL' to a string equal to two, resulting in the suppression of information messages.", 'Creating a tensor using TF.constant with a scalar value of 4 demonstrates a practical example of tensor initialization.', 'The chapter covers the manual initialization of tensors, including specifying shape and data type, with examples of creating matrices using tf.constant, tf.ones, tf.zeros, and tf.eye methods.', 'Using tf.ones to initialize a tensor with a specified shape, like tf.ones((3, 3)), creates a three by three matrix filled with ones.', 'Using tf.zeros to initialize a tensor with a specified shape, such as tf.zeros((2, 3)), creates a two by three matrix filled with zeros.', 'The tf.eye method is used to create an identity matrix, where tf.eye(n) produces an n by n identity matrix.', 'Creating a two-dimensional tensor using tf.constant with a list of lists, such as tf.constant([[1, 2, 3], [4, 5, 6]]), results in a two by three matrix.', 'Initialization of tensors covers various methods, mathematical operations, indexing, and reshaping of tensors.', 'Creating matrices from normal and uniform distributions TensorFlow provides methods for generating matrices from normal and uniform distributions, offering flexibility in initializing matrices for various applications.', 'Using the tf.range function in TensorFlow allows for the creation of sequences with specified start, limit, and delta values, providing flexibility in generating sequences for different purposes.', 'The tf.range function in TensorFlow allows for the specification of start, limit, and delta values, offering fine control over the generation of sequences for diverse applications.', 'Covers data type conversion using tf.cast for float32, float16, float64, tf.int, and tf.bool.', 'Introduction to mathematical operations in TensorFlow and creating two vectors for further operations.', 'Demonstration of using TensorFlow functions for matrix multiplication, emphasizing practical usage and convenience.', 'Easier and convenient ways of performing element-wise addition, subtraction, and division are shown, highlighting equivalent methods and practical preferences.', 'Discussed the various methods of tensor indexing and slicing, including excluding elements, obtaining specific elements, skipping elements, and reversing order, providing a holistic overview of tensor manipulation techniques.', 'Demonstrated indexing of a tensor to exclude the first element, obtaining a specific set of elements, and skipping every other element, providing clear examples of tensor manipulation techniques.', 'Explained the method to print the tensor in a reverse order, showcasing the versatility of tensor manipulation and providing a comprehensive understanding of tensor operations.', 'Covers tensorflow basics including data extraction, tensor indexing, and operations', 'Extracting specific values from a matrix and vector using TensorFlow', 'Selecting specific rows and elements from a tensor', 'Basics of tensor operations: reshaping, transposing, and permutation', 'Demonstrates reshaping a 1D array into a 3x3 matrix and transposing a matrix', 'Introduction to building basic neural networks']}