<?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 Gokul Soman on Medium]]></title>
        <description><![CDATA[Stories by Gokul Soman on Medium]]></description>
        <link>https://medium.com/@gokulsoman?source=rss-a8e6beb62ec------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*L80mdgK-xJslrlFB_JRPqg.jpeg</url>
            <title>Stories by Gokul Soman on Medium</title>
            <link>https://medium.com/@gokulsoman?source=rss-a8e6beb62ec------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 22:01:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gokulsoman/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[Five random pytorch functions]]></title>
            <link>https://gokulsoman.medium.com/five-random-pytorch-functions-af883cfa77ff?source=rss-a8e6beb62ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/af883cfa77ff</guid>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Gokul Soman]]></dc:creator>
            <pubDate>Fri, 02 Apr 2021 15:14:25 GMT</pubDate>
            <atom:updated>2021-04-02T17:01:48.708Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*6kBRkv2TzD8m6x-2.png" /></figure><h3><strong>1. quantize_per_tensor</strong></h3><p>Quantization is to convert values from floating point precision to integers for reducing computation and/or bitwidth of storage.</p><p>Allows the execution of operations on integers rather than floating point numbers.</p><p>It is primarily used for inference, and supports only forward pass. Does not support CUDA, hence model needs to be ported to CPU only mode. There is fake quantization which supports both CUDA and CPU.</p><p><strong>Input format</strong> — (tensor, scale, zero-point, target data type)</p><p>Operation as I understand -&gt; roundoff((tensor/scale) + zero-point)</p><p><strong>Output</strong> — quantized tensor</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fgklsoman%2F01-tensor-operations%2Fv%2F5%26cellId%3D5&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fgklsoman%2F01-tensor-operations%2Fv%2F5%26cellId%3D5&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F014f49e3665b42c3ba9a9008797fe196%2Fpreview%2F2ced40d10d5c4268b171989a12f51ca4%3Fsize%3Dl&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/14d971f57bdebbba59f173d542b69bc5/href">https://medium.com/media/14d971f57bdebbba59f173d542b69bc5/href</a></iframe><h3>2. <strong>heaviside</strong></h3><p>Comes under tensor creation operations</p><p><strong>Format: </strong>torch.heaviside(tensor, value)</p><p><strong>Output</strong>:</p><p>If tensor_elem &lt; 0 → -1 ,</p><p>— tensor_elem == 0 → value</p><p>— tensor_elem &gt; 0 → 1</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fgklsoman%2F01-tensor-operations%2Fv%2F5%26cellId%3D20&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fgklsoman%2F01-tensor-operations%2Fv%2F5%26cellId%3D20&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F014f49e3665b42c3ba9a9008797fe196%2Fpreview%2Fd2f7af76142d4b2fbb35d86ff7a26962%3Fsize%3Dl&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/01b0e6b60d9a4c48714e6a242f74f08e/href">https://medium.com/media/01b0e6b60d9a4c48714e6a242f74f08e/href</a></iframe><h3><strong>3. masked_select</strong></h3><p>It is used to take only a subset of the tensor_elements from a tensor, using a boolean tensor mask.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fgklsoman%2F01-tensor-operations%2Fv%2F5%26cellId%3D27&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fgklsoman%2F01-tensor-operations%2Fv%2F5%26cellId%3D27&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F014f49e3665b42c3ba9a9008797fe196%2Fpreview%2Ff9f5694f920a4a8aa90244f32795c869%3Fsize%3Dl&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/7590a0d296f2172d0c0eca4c53691ce2/href">https://medium.com/media/7590a0d296f2172d0c0eca4c53691ce2/href</a></iframe><h3><strong>4. expm1</strong></h3><p>Each output tensor element would be exponential minus 1 of the input</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fgklsoman%2F01-tensor-operations%2Fv%2F5%26cellId%3D37&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fgklsoman%2F01-tensor-operations%2Fv%2F5%26cellId%3D37&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F014f49e3665b42c3ba9a9008797fe196%2Fpreview%2Fd9b878ef94a24e1392cc882558fde11e%3Fsize%3Dl&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/0006fb6a372715fed234ac9c8f0a8a00/href">https://medium.com/media/0006fb6a372715fed234ac9c8f0a8a00/href</a></iframe><h3><strong>5. use_deterministic_algorithms</strong></h3><p>Use deterministic algorithms when possible. If none are available, returns runtime error.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fgklsoman%2F01-tensor-operations%2Fv%2F5%26cellId%3D46&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fgklsoman%2F01-tensor-operations%2Fv%2F5%26cellId%3D46&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F014f49e3665b42c3ba9a9008797fe196%2Fpreview%2F4c43eb5ef03e4c449e7153f39fe70870%3Fsize%3Dl&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/4829eea99249f83cd5c58ce4408f1eba/href">https://medium.com/media/4829eea99249f83cd5c58ce4408f1eba/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af883cfa77ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>