<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ismath Haakifa on Medium]]></title>
        <description><![CDATA[Stories by Ismath Haakifa on Medium]]></description>
        <link>https://medium.com/@ismathhaakifa?source=rss-40c7a41be96------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*IpS634cXjWde8mjwQen5FA@2x.jpeg</url>
            <title>Stories by Ismath Haakifa on Medium</title>
            <link>https://medium.com/@ismathhaakifa?source=rss-40c7a41be96------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 00:12:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ismathhaakifa/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Beginner’s Guide to Website Design]]></title>
            <link>https://blog.devgenius.io/a-beginners-guide-to-website-design-50cc6ac4298f?source=rss-40c7a41be96------2</link>
            <guid isPermaLink="false">https://medium.com/p/50cc6ac4298f</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[website-design]]></category>
            <category><![CDATA[website-development]]></category>
            <category><![CDATA[resources]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <dc:creator><![CDATA[Ismath Haakifa]]></dc:creator>
            <pubDate>Mon, 29 Jun 2020 10:53:43 GMT</pubDate>
            <atom:updated>2020-07-01T09:46:16.035Z</atom:updated>
            <content:encoded><![CDATA[<h4>If you a beginner and struggling to find the right resources for your website, this blog post is a compilation of all the resources required to get you started</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5lLGYJXaxAKqdevef94-QQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@halacious?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Halacious</a> on Unsplash</figcaption></figure><p>So, past few months I have been working on learning how to set up a blog and design my Website on my own from scratch.</p><p>During this process, I have been helping my friends and through them, I got to work on a few projects for clients.</p><p>I really had to research a lot since I was a beginner and below are the resources that I found super useful.</p><p>Okay, I’ll take you through this whole post in form of steps that I usually take while building my websites.</p><h3><strong>Step 1</strong></h3><p><strong>Everyone needs an Inspiration or a base Idea, </strong>so what I do is, look for some inspiration from the following websites:</p><p><a href="https://www.awwwards.com/">Awaards</a> — They have a collection of really awesome websites but being a beginner one might be discouraged. Don’t worry I have got a hack for you.</p><p>Just go to the website, search for the color or just look around and preview the ‘live site’ of the website which really catches your eyes, check for the fonts they have used by using the ‘Inspect element’ property of your browser. Try using that font on your website. It really helps in reducing the time to search for the perfect font, trust me on this!</p><p><a href="https://dribbble.com/">Dribble</a> — What I like about dribble is that they have a collection of really awesome illustrations and the color combinations which the designers use are just mind-boggling (Awaards on the other hand just has live sites of all colors). Dribble also has collections of websites which again is super amazing but I mostly use Dribble for their Illustrations. You are free to do whatever you like (As a beginner, it’s always better to explore and try out different things until you become good at it! )</p><p><a href="https://www.behance.net/">Behance</a> — Behance too has a good collection of Design Projects but the real amazing thing is, they conduct Live sessions where they teach you how to use their Products, through this you get to learn how to make cool illustrations and editing to the photos which you can later use in your Profile.</p><p>But the one really awesome product which Adobe offers is Adobe XD, just perfect for making a mockup of the site which you wish to build. This is the perfect way to remove the unwanted stress which you might cause on yourself while building the actual Website.</p><p><a href="https://www.uplabs.com/">Uplabs</a> — This website has awesome templates and also you can browse through a ton of projects based on the software it was designed with, to get inspirations accordingly.</p><p>A twitter user suggested this to me and now Uplabs is one of my favorite.</p><h3><strong>Step 2</strong></h3><p><strong>Choosing the perfect color Pallete, </strong>Colors can really make or break your website. Okay! what I meant is choose your color palette wisely and try to choose combinations of dark and light, so it can be used for texts and backgrounds respectively.</p><p>A little story, recently I was working on my Personal Portfolio and I had decided on #e19999, #f1d1d1, #aacfcf, and #faf2f2 (have a look at these colors and you’ll understand what I’m talking about) as my palette since these colors reflected me. So what happened was, I almost completed the entire Site and sent it to my friend for a review. She has a partial vision impairment and I didn’t know that since she was diagnosed recently. So she replied to me stating that she’s having a really hard time with my portfolio and told me to send it to someone else for a proper review.</p><p>I felt really bad that my close friend was unable to go through my site. That’s when I started reading properly about accessibility (FreeCode Camp had taught about it but I forgot) and how to make my site more accessible.</p><p>I decided to change my palette and the whole layout to make it more accessible and I haven’t completed yet but I love how it has turned out till now.</p><h3></h3><p></p><p>So coming back to Step 2, choosing colors is really important so what I suggest is check out the below websites:</p><p><a href="https://colorhunt.co/">Colorhunt</a> — You really get to see amazing color palettes that are trending and based on the number of likes each has, you can finalize your palette. But just like I said earlier, try to mix and match until you feel really good about it.</p><p><a href="https://coolors.co/">Coolors</a> — The best place to actually mix and match whatever colors you want. But one drawback I felt (maybe it’s my problem) was, it can really take hours to decide on a 5-color palette because our brain (at least mine) just stops working and shows how indecisive it can truly get.</p><p>So yes, Inspiration and Colors are done. Next up, we look into Fonts.</p><h3><strong>Step 3</strong></h3><p><strong>Deciding a good Font for your website, </strong>this can get really hard since there are just so many options available and finalizing on one can be quite difficult.</p><p><em>I’m assuming you have a skeleton of all your content</em></p><p>Let’s head over to any one of the following websites:</p><p><a href="https://fonts.google.com/">Google Fonts</a> — This one is free and in fact the most widely used website for deciding on fonts. What I suggest is based on your theme, check the styles your website would go with like for Heading go with a font with a higher weight and likewise. I hope you get the point, just try, and as suggested previously you can get inspiration from other websites.</p><p><a href="https://fonts.adobe.com/">Adobe Fonts</a> — If you don’t mind paying for getting a good set of fonts, then Adobe Fonts are the ones you should be going with. It has some uniques styles which make it look elegant and nice on webpages.</p><p>So we have done a good job in deciding three major things needed for giving our Website some cool look.</p><p>Next,</p><h3><strong>Step 4</strong></h3><p><strong>Deciding on Images for different sections</strong> of your website, this is a gradual process but make sure you use licensed and high-quality pictures to make it look really good. Sites like the below have a collection of amazing pictures taken by some really talented photographers.</p><p>So head over to any one of the following websites:</p><p><a href="https://unsplash.com/">Unsplash</a> — Just look at those images, aren’t you already feeling excited to use them in your website. Right! I too feel the same. Now, search for the images you want (Just a tip: I usually search for images according to colors, so it’s more aligned with my Website color palette) and once you are done, click on Download, here make sure you take note of the Owner’s name to be used later in the credits part of your Website (Credits are really very important, always make sure to give credits to the Owner because they have taken the time to actually click such amazing pictures and put it up for free for us to use it! So yes, Credits are really very important :))</p><p><a href="https://www.pexels.com/">Pexels</a> — Just like Unsplash, Pexels also has really amazing, high-quality Images. So do make sure to check this one also.</p><p>I usually juggle between Pexels and Unsplash because sometimes I find really nice Images, fitting perfectly for my Website in Pexels, and sometimes it’s the other way round. So try to juggle between two and decide on the perfect Image. One more thing to remember, if you have decided and are satisfied with the first image you got from one of these websites, then Don’t waste your time searching for more, just head over to the next step.</p><h3><strong>Step 5</strong></h3><p><strong>Choosing Icons</strong> is again a gradual process unless you are really sure of your mockup, then you have a clear picture of all the Icons you need beforehand but again, being a beginner it can be really hard to decide what all you’ll be needing beforehand so it’s perfectly fine to search as and when required.</p><p>Now for the Icons,</p><p><a href="https://fontawesome.com/v4.7.0/">Font Awesome</a> — Most YouTubers prefer this and I would also say the same because it has Icons for literally everything, making it a one-stop solution for us. Search for the Icon you want and then copy it’s <strong>&lt;i&gt;&lt;/i&gt;</strong> tag and then paste it in your HTML file in the place where you want to use it and then add the below block of code inside the <strong>&lt;head&gt;</strong> tag</p><pre>&lt;script defer=&quot;&quot; src=&quot;<a href="https://use.fontawesome.com/releases/v5.1.1/js/solid.js">https://use.fontawesome.com/releases/v5.1.1/js/solid.js</a>&quot; integrity=&quot;sha384-GXi56ipjsBwAe6v5X4xSrVNXGOmpdJYZEEh/0/GqJ3JTHsfDsF8v0YQvZCJYAiGu&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;</pre><pre>    &lt;script defer=&quot;&quot; src=&quot;<a href="https://use.fontawesome.com/releases/v5.1.1/js/brands.js">https://use.fontawesome.com/releases/v5.1.1/js/brands.js</a>&quot; integrity=&quot;sha384-0inRy4HkP0hJ038ZyfQ4vLl+F4POKbqnaUB6ewmU4dWP0ki8Q27A0VFiVRIpscvL&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;</pre><pre>    &lt;script defer=&quot;&quot; src=&quot;<a href="https://use.fontawesome.com/releases/v5.1.1/js/fontawesome.js">https://use.fontawesome.com/releases/v5.1.1/js/fontawesome.js</a>&quot; integrity=&quot;sha384-NY6PHjYLP2f+gL3uaVfqUZImmw71ArL9+Roi9o+I4+RBqArA2CfW1sJ1wkABFfPe&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;</pre><p>Now everything is almost set!</p><p><a href="https://thenounproject.com/">The Noun Project</a> — Once again a Twitter user had suggested this one to me and I personally haven’t started using them for my websites by rather for my Presentations. One good thing which I really loved about this website is that they have a collection of really amazing Icons and the colors can be changed according to your wish which is an added benefit to suit your needs.</p><h3>Step 6</h3><p><strong>Adding Emojis </strong>to your website can be a cool thing since it’s kind of a trending matter now, so that’s why I chose to add emojis to my Portfolio Website and I really like how it makes my texts more descriptive. If you also want to use them, then head over to</p><p><a href="https://getemoji.com/">Get Emoji</a> — It’s so simple to add emojis to your website because this site provides a feature of copy and paste it into your HTML file which is super cool and easy.</p><p>So, the next step which is</p><h3><strong>Step 7</strong></h3><p><strong>Choosing Illustrations,</strong> illustrations are really nice if you want to make your Websites more descriptive and colorful, so my picks are:</p><p><a href="https://illlustrations.co/">Illustrations</a> — This site has a collection of really cool generic illustrations that are colorful and fun-looking.</p><p><a href="https://blush.design/">Blush.design </a>— This website has a lot of illustrations of people with and without a backdrop. This is a life-saver for me because the cool thing about this site is you can change the positions (meaning, you get the sitting, standing, etc. poses) of these people. One more thing, since I wear a Hijab this site is one of the few which has some really awesome looking illustrations with Hijabs on. There are also a few with Turbans, etc. I just love them!</p><p><a href="https://www.blackillustrations.com/?ref=producthunt">Black Illustrations</a> — This site is just a pool of everything with Black people, really awesome and amazing!</p><h3>Step 8</h3><p><strong>Choosing a Filler Text</strong>, when you don’t have your Contents planned for your website, then just like all the Web-Developers do, use the Lorem Ipsum text to be used as a placeholder value, so head over to</p><p><a href="https://www.lipsum.com/">Lipsum</a> — Just copy and paste the generated text and use them in places where you need to fill, so later on when you are done with designing the actual Website, you can properly focus on creating the content as required.</p><p>Just a word, the above are the steps which I usually take (Steps 6 and 7 are optional) but you are free to mix and match as you like.</p><p>Now, with all assets in your hand, you can now head over to complete your website.</p><p>Happy Creating ☺️</p><p>Thank you for reading! I hope this article helps you in having all the resources for your website in a single place. In the upcoming article, I plan on creating a collection of all the resources which I’m using to learn Web- Development.</p><p>If you have any suggestions, do feel free to let me know (via comments or through <a href="https://twitter.com/ismathim">Twitter</a>) so I can update the above list accordingly.</p><p>Stay safe &amp; healthy 🌸</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50cc6ac4298f" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/a-beginners-guide-to-website-design-50cc6ac4298f">A Beginner’s Guide to Website Design</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I’m an Artist]]></title>
            <link>https://medium.com/series/im-an-artist-b1ea7a26f5f7?source=rss-40c7a41be96------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1ea7a26f5f7</guid>
            <dc:creator><![CDATA[Ismath Haakifa]]></dc:creator>
            <pubDate>Fri, 26 Jun 2020 09:12:03 GMT</pubDate>
            <atom:updated>2020-06-26T09:12:50.620Z</atom:updated>
            <content:encoded><![CDATA[<p>Loneliness is defined as the feeling we get when we seek for a social contact but our relationship needs are not met.</p><p>During a normal day, the hustle and bustle of the work keeps one occupied and sane. It also keeps the person from thinking about oneself, stealing the space and time for self-introspection.</p><p>During this journey, many of us forget the very crux of life which is to enjoy every second of it.</p><p>In this very hustle, we forget those childhood fantasies we created, hobbies which we had and the activities which we did to just squeeze that idea muscle.</p><p>But 2020 got about a change to everyone’s life, it made us to sit in silence and just introspect our very own existence.</p><p>Many of us started revisiting our hobbies and started sharing the end results on the social media platforms. Interest groups were formed over mediums like Slack and Discord, opinions were shared from people across the globe.</p><p>Yet again we all go back to the same hustle but in a different and virtual form.</p><p>Amongst all these happenings, there are people who are stuck. Not just stuck at homes but stuck mentally and emotionally. These are people wanting someone to just listen to them, appreciate their small efforts and give time when they ask for. These people have millions of skills, some are good artists, some are good writers some are very good at paper cutting and the list can go on endlessly.</p><p>These people have just one thing in common which is holding them back, loneliness.</p><blockquote>No one knows who might change one’s life but everyone knows each of us can if we just listen to each other.</blockquote><p>…</p><p><em>A short poem I composed on mental heath</em></p><h3>I’m an Artist</h3><p>As the hustling broke out,</p><p>I set out for a deep venture.</p><p>Beyond my house, into the cities,</p><p>Into the darkness that overtook the light.</p><p>Searching for an answer.</p><p>The answer which everyone seems to have except me.</p><p>A bit of self-introspection, did a little heal.</p><p>Yet millions of personas to adore,</p><p>I chose one.</p><p>The one which glistened on me,</p><p>The one which got the real me</p><p>The one which chose to be my friend.</p><p>Crafting my wound in art,</p><p>Did I attract the lot,</p><p>Lot which giggled,</p><p>Lot which smirked ,</p><p>Lot which stamped.</p><p>A bit of music and wood</p><p>Dancing merrily did I clean,</p><p>The hatred the world showed.</p><p>I’m a reformed soul,</p><p>Just adjusting to the reality,</p><p>Don’t know it’s inside Earth</p><p>Or Outside, trying to cope,</p><p>With the new place.</p><p>I’m an Artist.</p><p>…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1ea7a26f5f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A glimpse into Pytorch]]></title>
            <link>https://medium.com/@ismathhaakifa/a-beginners-guide-to-pytorch-a-glimpse-into-some-cool-functions-57cea2ea903b?source=rss-40c7a41be96------2</link>
            <guid isPermaLink="false">https://medium.com/p/57cea2ea903b</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[gans]]></category>
            <dc:creator><![CDATA[Ismath Haakifa]]></dc:creator>
            <pubDate>Sat, 30 May 2020 10:28:03 GMT</pubDate>
            <atom:updated>2020-05-31T20:36:44.171Z</atom:updated>
            <content:encoded><![CDATA[<h3>A glimpse into PyTorch</h3><h4>Practical and hands-on examples for getting started with PyTorch for Deep Learning</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U2doBF3eEw_mHMbeJBpuQg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@codestorm?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Safar Safarov</a> on <a href="https://unsplash.com/s/photos/coding?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Congratulations! If you are reading this then it means you have embarked on the Machine Learning journey just like me or want to broaden your learning curve. Either way, this article will help you get some insight into PyTorch so without further ado let’s get started.</p><h3>What is PyTorch?</h3><p>A simple question which a friend asked me two weeks ago and I didn’t know anything about it. No, I knew it’s existence but didn’t really know how to explain it to him. So I started reading and researching and I came across a 6-weeks Course offered by Jovian.ml, I immediately enrolled in it. This is the first week and I should say, I know the basics to some extent. Okay, so what is PyTorch? If you had taken or done any courses or watched videos related to Neural Networks, you would have seen the number of computations required to perform simple functions and training. In order to ease all these, Developer at Python generously came up with a Framework just for making our lives easier, this contains simple go-to functions for computing any complex tasks and in turn, improves the efficiency of our Program. This Framework is none other than <a href="https://pytorch.org/">PyTorch</a> (Don’t you love it already!)</p><p><strong>Note</strong>: PyTorch is a ‘Framework’ as described in the official documentation but there are times when the terms ‘library’ and ‘frameworks’ are used interchangeably, I’ll be using the term ‘Framework’ throughout my article. But if you are interested to know about the difference, then give this <a href="https://www.programcreek.com/2011/09/what-is-the-difference-between-a-java-library-and-a-framework/">article</a> a read.</p><h3>What’s the main advantage of PyTorch?</h3><p>Well, before that let’s just look at history. PyTorch was released only in the year 2016, primarily developed by <a href="https://ai.facebook.com/">Facebook’s AI Research lab</a> and since then many researchers are using this library for their work. Well, you might ask me what were they using before that. Sure, so PyTorch is not alone, it also has competitors just like Messi has Ronaldo. <a href="https://www.tensorflow.org/">TensorFlow</a>, an end-to-end open-source platform for machine learning was released in 2015 by Google, is a very famous competitor that is used in the Deep Learning space and is in use today for processing large-scale applications. PyTorch on the other hand has a competitive advantage over TensorFlow in the fast development of projects that need to be up and running in a really short time.</p><h3>Some glimpse into PyTorch functions</h3><p>Let’s start with a <a href="https://medium.com/@quantumsteinke/whats-the-difference-between-a-matrix-and-a-tensor-4505fbdc576c"><strong>tensor</strong></a><strong>, </strong>which is a generalization of vectors and matrices and is easily understood as a multidimensional array. In PyTorch, <strong><em>torch.Tensor()</em></strong> is the function used for constructing tensors.</p><p>Now let’s dive into some basic Functions which I think is awesome to know as a Beginner.</p><p>So some of them which I’ll be explaining in detail are:</p><ul><li>torch.cat( )</li><li>torch.chunk( )</li><li>torch.det( )</li><li>torch.unique( )</li><li>torch.mul( )</li></ul><h3>Function 1- torch.cat( ):</h3><p><strong><em>Syntax:</em></strong><em> torch.cat(tensors, dim=0, out=None) → Tensor</em></p><p><strong><em>Parameters:</em></strong></p><ul><li><strong>tensors </strong>(sequence of Tensors) — any python sequence of tensors of the same type. Non-empty tensors provided must have the same shape, except in the cat dimension.</li><li><strong>dim</strong> (int, optional) — the dimension over which the tensors are concatenated</li><li><strong>out</strong> (Tensor, optional) — the output tensor</li></ul><p>Though I love cats, this function mainly helps in <strong>concatenating</strong> the given sequence of tensors in the given dimension.</p><p>So suppose we are given two or more Tensors, having the same dimension and were to concatenate and use them then we would use the <strong>torch.cat()</strong> function to perform this operation. Let’s see how this is done in code.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F5%26cellId%3D4&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F5%26cellId%3D4&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/6e800840b4423389f285d62d443f7d9a/href">https://medium.com/media/6e800840b4423389f285d62d443f7d9a/href</a></iframe><p>As we can see In the above code, a tensor having 2 rows and 3 columns is generated randomly using the <strong>torch.randn()</strong> function. This is then passed inside the <strong>torch.cat()</strong> function. In this example, the ‘a’ tensor needs to be concatenated 3 times, hence it is used 3 times inside the ‘torch.cat’ function, which then concatenates either along the x-direction which is denoted with a ‘0’ or along the y-direction which is denoted with a ‘1’.</p><p>Clear? Let’s look at another example.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F5%26cellId%3D6&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F5%26cellId%3D6&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/089dd1ce719a372c337442ff731e81c5/href">https://medium.com/media/089dd1ce719a372c337442ff731e81c5/href</a></iframe><p>The main difference between this example and example 1 is that in example 2 we are converting the decimal values into whole numbers by multiplying it with 100 and then performing the concatenation the way we did in the previous example.</p><p>So these are the cases when the function works properly, but we do know that the function returns an error when we pass tensors with different dimensions, so why not test it.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F5%26cellId%3D8&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F5%26cellId%3D8&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/e688eaff263b040847561e165ebb3852/href">https://medium.com/media/e688eaff263b040847561e165ebb3852/href</a></iframe><p>Well, that’s with this function. The main use case of a Concatenation function is when we are processing like a really large number of datasets and want to combine two or more of them maybe because they have the same set data collected from different sources and has needed to be combined together for further analysis.</p><p>Next up,</p><h3>Function 2- torch.chunk( ):</h3><p><strong><em>Syntax</em></strong>: torch.chunk(input, chunks, dim=0) → List of Tensors</p><p><strong><em>Parameters:</em></strong></p><ul><li><strong>input</strong> (Tensor) — the tensor to split</li><li><strong>chunks</strong> (int) — number of chunks to return</li><li><strong>dim</strong> (int) — dimension along which to split the tensor</li></ul><p>This name is just so funny for some reason and its main function is to split a tensor into a specific number of chunks.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F9%26cellId%3D13&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F9%26cellId%3D13&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/1ff0252b2ec5aa9071adf0fb71310036/href">https://medium.com/media/1ff0252b2ec5aa9071adf0fb71310036/href</a></iframe><p>As we can see in the above code, we have generated a tensor having 4 elements on random using the <strong>torch.randn()</strong> function which is then passed on inside the <strong>torch.chunk()</strong> function, along with the number of chunks the tensors have to be divided into. The function then returns two new chunks of the original Tensors.</p><p>Let’s see one more example.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D15&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D15&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/01f1de219b2eaab6463b9b0ad05064b8/href">https://medium.com/media/01f1de219b2eaab6463b9b0ad05064b8/href</a></iframe><p>In this example, we are working with a 2x2 matrix that is passed inside the <strong>torch.chunk() </strong>function along with another new value which is the direction along which the chunking operation has to be performed. If the value is 0, then the operation is performed along the x-direction and if it is 1, then it is along the y-direction.</p><p>Again, let’s look into an example where the operation breaks.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D17&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D17&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/270cfdc7811f9eb5a4de195f58e22609/href">https://medium.com/media/270cfdc7811f9eb5a4de195f58e22609/href</a></iframe><p>Passing an argument specifying the number of chunks is a must, else PyTorch returns a TypeError as shown above.</p><p>Also, sometimes when we have a tensor and pass a chunk value, <strong>torch.chunk() </strong>doesn’t really return the number of chunks as specified. This can happen when the tensor can’t be equally divided over the given number of chunks.</p><p>The main use case of a Chunk function is mainly for dividing a large dataset into smaller chunks which can further be used for easing the analysis.</p><p>The next function deals with something which takes a longer time to do it manually.</p><h3>Function 3- torch.det( ):</h3><p><strong><em>Syntax</em></strong>: torch.det(input) → Tensor</p><p><strong><em>Parameters:</em></strong></p><ul><li><strong>input</strong> (Tensor) — the input tensor of size (<em>, n, n) where </em>is zero or more batch dimensions.</li></ul><p>Sometimes, I lose few marks in my maths test because of this determinant calculation, I usually mess up with the signs and end up getting a wrong answer <strong>torch.det( )</strong> function exactly helps in solving this very problem.</p><p>Let’s do an example and see how easy is this.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D22&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D22&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/130913b87e0fe991e5148a792dfcb7d0/href">https://medium.com/media/130913b87e0fe991e5148a792dfcb7d0/href</a></iframe><p>This was so simple and the time taken was just a few seconds. Let me explain, we just passed a 4x4 Tensor inside the <strong>torch.det()</strong> function which calculated the determinant of the above.</p><p>Let’s do one more example,</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D24&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D24&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e363d98f115ac9d2b687fb02042013e/href">https://medium.com/media/3e363d98f115ac9d2b687fb02042013e/href</a></iframe><p>In the above code, we generate 4, 4x4 matrix and then pass it inside the <strong>torch.det() </strong>function to calculate the determinant of the matrices. Needless to say, it took very few seconds and returned it in the form of a Tensor.</p><p>Now, a breaking condition</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D26&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D26&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d50c5c6be8dd1f1207b1108a0a865c0/href">https://medium.com/media/2d50c5c6be8dd1f1207b1108a0a865c0/href</a></iframe><p>The main condition for calculating the determinant of any matrix is that it should be a Square matrix (n x n), as we can see PyTorch returns an error stating the same.</p><p>The determinant calculation doesn’t just stop with School/University education but rather is used in real-world applications like 3D graphics, where determinants are used for representing Linear Transformations.</p><h3>Function 4- torch.unique( ):</h3><p><strong><em>Syntax:</em></strong> torch.unique(*args, <strong>kwargs</strong>)</p><p><strong><em>Parameters:</em></strong></p><ul><li><strong>input</strong> (Tensor) — the input tensor</li><li><strong>sorted</strong> (bool) — Whether to sort the unique elements in ascending order before returning as output.</li><li><strong>return_inverse</strong> (bool) — Whether to also return the indices for were elements in the original input ended up in the returned unique list.</li><li><strong>return_counts</strong> (bool) — Whether to also return the counts for each unique element.</li><li><strong>dim</strong> (int) — the dimension to apply unique. If None, the uniqueness of the flattened input is returned. default: None</li></ul><p>Just like the way an individual has his/her unique characters, datasets also have some unique values. PyTorch provides an amazing and efficient way to extract only the unique values through this function awesome function, <strong>torch.unique().</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D31&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D31&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/990ea72587cde51f59f26356a226cd33/href">https://medium.com/media/990ea72587cde51f59f26356a226cd33/href</a></iframe><p>We passed a very small dataset, having just a few elements across the tensor inside the <strong>torch.unique()</strong> function, which returned the unique elements as shown in the output.</p><p>Let’s make it a little more complex and pass in more Tensors,</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F12%26cellId%3D33&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F12%26cellId%3D33&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/85f6c7c1d0c8434dc26a56068e071bb2/href">https://medium.com/media/85f6c7c1d0c8434dc26a56068e071bb2/href</a></iframe><p>As we can see in the above example, a 20x20 matrix, having the lowest as 0 and the highest value as 20 is generated randomly using the <strong>torch.randint() </strong>function, this was passed inside the <strong>torch.unique() </strong>function which returned just the unique values as expected.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F12%26cellId%3D35&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F12%26cellId%3D35&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/c955f4764b8d702772e5e9fcf16c7b3f/href">https://medium.com/media/c955f4764b8d702772e5e9fcf16c7b3f/href</a></iframe><p>Although the example above did not show any errors, the output is not what we expected because it is clearly mentioned that 9.00004 is a different number from the rest of the lot but the function didn’t really consider that as a unique value which is not quite right even though the difference might be minute.</p><p>This function is mainly used in places where we need to extract details about the unique values like checking the names of the parts inside an Inventory and the like.</p><h3>Function 5- torch.mul( ):</h3><p><strong><em>Syntax:</em></strong> torch.mul(input, other, out=None)</p><p><strong><em>Parameters:</em></strong></p><ul><li>input (Tensor) — the first multiplicand tensor</li><li>other (Tensor) — the second multiplicand tensor</li><li>out (Tensor, optional) — the output tensor.</li></ul><p>Who doesn’t love multiplication, but what about multiplying huge matrices together, It’s really a nightmare, isn’t it? Well, PyTorch is always there for the rescue. This very function, <strong>torch.mul( ) </strong>helps in multiplying huge matrices together.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D40&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D40&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/3ad790588c3f39876ea74f95516d47b7/href">https://medium.com/media/3ad790588c3f39876ea74f95516d47b7/href</a></iframe><p>In the above example, two simple 2x2 matrices are multiplied together using the <strong>torch.mul() </strong>function and the value is returned as a 2x2 matrix.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D42&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D42&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/aace31f121b91c5b8ba7b32ec2ead866/href">https://medium.com/media/aace31f121b91c5b8ba7b32ec2ead866/href</a></iframe><p>We generated slightly more complex tensors, which was then passed inside the <strong>torch.mul( ) </strong>function for computing the product.</p><p>Let’s try passing in matrices having different dimensions,</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D43&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Fismathim%2F01-pytorch-basics%2Fv%2F10%26cellId%3D43&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b3cab13ab12f3f9eb45b0d0d355511d/href">https://medium.com/media/3b3cab13ab12f3f9eb45b0d0d355511d/href</a></iframe><p>It can be seen clearly, that our program encounters a RuntimeError, stating that the size of the first tensor should match that of the second one.</p><p>Multiplication of huge matrices is used in places that involve calculation of Linear equations like Network Theory, Transformation of co-ordinate systems, population modeling, etc.</p><h3>Conclusion</h3><p>That was really a fun start! I hope you would have gained some glimpse into the basics of PyTorch.</p><p>Just a quick summary of what we did:</p><ol><li>We went through What is PyTorch</li><li>Why it’s a better choice than it’s competitors</li><li>We looked into some of its functions and where they were used.</li></ol><p>This was just a bit from the vast functionality PyTorch offers. Referring to the official documentation for any projects is always a good practice. Also, do check out these amazing resources for further reading:</p><ol><li><a href="https://www.freecodecamp.org/">FreeCodeCamp</a>- It’s an open-source community that helps to code, build pro bono projects for nonprofits, and get a job as a developer.</li><li><a href="http://jovian.ml/">jovian.ml</a>: A place for your data science projects, Jupyter notebooks, machine learning models, experiment logs, results, and more.</li></ol><h3>References</h3><p>[1]<a href="https://pytorch.org/docs/stable/tensors.html">Official documentation of PyTorch</a></p><p>[2]<a href="https://jovian.ml/ismathim/01-pytorch-basics">My Jupyter notebook</a>, hosted on the jovian.ml platform</p><p>I hope, this article helps you in getting started with PyTorch. In the upcoming articles, I’ll be diving deep into PyTorch and where it’s used in Machine Learning and hopefully end this series with a good Project.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57cea2ea903b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>