# \#2 PyTorch Book Thread: Sunday, 5th Sept 8AM PT

**URL:** <https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431>\
**Category:** PyTorch Book Reading Group\
**Created:** [September 5, 2021, 11:57am UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431 "2021-09-05T11:57:54Z")\
**Posts on this page:** 19\
**Page:** 2

<div class="post-metadata">

**Author:** ![girijesh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/girijesh/32/39_2.png) [@girijesh](https://community.wandb.ai/u/girijesh)\
**Post date:** [September 5, 2021, 3:49pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/22 "2021-09-05T15:49:38Z")

</div>

1st row is header!!!

---

<div class="post-metadata">

**Author:** ![matt24](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/matt24/32/62_2.png) [@matt24](https://community.wandb.ai/u/matt24)\
**Post date:** [September 5, 2021, 3:49pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/23 "2021-09-05T15:49:54Z")

</div>

usually the first row contains the headers

---

<div class="post-metadata">

**Author:** ![jc17](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@jc17](https://community.wandb.ai/u/jc17)\
**Post date:** [September 5, 2021, 4:04pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/24 "2021-09-05T16:04:08Z")

</div>

Simplest – Consider each word having an ID – and do one hot encoding…

---

<div class="post-metadata">

**Author:** ![girijesh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/girijesh/32/39_2.png) [@girijesh](https://community.wandb.ai/u/girijesh)\
**Post date:** [September 5, 2021, 4:04pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/25 "2021-09-05T16:04:27Z")

</div>

simples is One hot encoding as we do in Bag of Words !  
then we can use word2vec

---

<div class="post-metadata">

**Author:** ![yuvraj](https://avatars.discourse-cdn.com/v4/letter/y/b5a626/32.png) [@yuvraj](https://community.wandb.ai/u/yuvraj)\
**Post date:** [September 5, 2021, 4:04pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/26 "2021-09-05T16:04:31Z")

</div>

by finding a way to convert the representation in numbers, for example creating a dictionary of all words and representing a word with its index in that dictionary.

---

<div class="post-metadata">

**Author:** ![girijesh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/girijesh/32/39_2.png) [@girijesh](https://community.wandb.ai/u/girijesh)\
**Post date:** [September 5, 2021, 4:05pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/27 "2021-09-05T16:05:37Z")

</div>

for punctuation and other things we can we can remove as preprocessing steps

---

<div class="post-metadata">

**Author:** ![simplysumanth](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/simplysumanth/32/160_2.png) [@simplysumanth](https://community.wandb.ai/u/simplysumanth)\
**Post date:** [September 5, 2021, 4:09pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/28 "2021-09-05T16:09:38Z")

</div>

**This is Off-topic** :  
In one of the Kaggle project for Image Classification → Evaluation metric was f1\_score Macro. So during training do we need to use the same metric (other than accuracy) …if so this is not in pytorch (it’s in sklearn), So how can we use it in GPU based model?

---

<div class="post-metadata">

**Author:** ![girijesh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/girijesh/32/39_2.png) [@girijesh](https://community.wandb.ai/u/girijesh)\
**Post date:** [September 5, 2021, 4:28pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/29 "2021-09-05T16:28:05Z")

</div>

What does exactly mean by non-linearity here, as here we took y = mx + c is a linear equation!!

---

<div class="post-metadata">

**Author:** ![bhutanisanyam1](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/bhutanisanyam1/32/18_2.png) [@bhutanisanyam1](https://community.wandb.ai/u/bhutanisanyam1)\
**Post date:** [September 5, 2021, 4:28pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/30 "2021-09-05T16:28:26Z")

</div>

> **[Different ways of getting datasets for your data science tasks](https://pandeyparul.medium.com/different-ways-of-getting-datasets-for-your-data-science-tasks-ecb159bf7893)**
>
> Resources for finding datasets suitable for your needs.

---

<div class="post-metadata">

**Author:** ![girijesh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/girijesh/32/39_2.png) [@girijesh](https://community.wandb.ai/u/girijesh)\
**Post date:** [September 5, 2021, 4:30pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/31 "2021-09-05T16:30:58Z")

</div>

**Home work**

1. Try ImageIO and TorchVision
2. Read hd5py module
3. Make a cheat sheet for all handy function used in today’s class
4. Think about making a documentation for permute function.
5. Time series

---

<div class="post-metadata">

**Author:** ![yuvraj](https://avatars.discourse-cdn.com/v4/letter/y/b5a626/32.png) [@yuvraj](https://community.wandb.ai/u/yuvraj)\
**Post date:** [September 5, 2021, 4:32pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/32 "2021-09-05T16:32:00Z")

</div>

Great stuff! Thanks.

---

<div class="post-metadata">

**Author:** ![nandeshwar](https://avatars.discourse-cdn.com/v4/letter/n/e9bcb4/32.png) [@nandeshwar](https://community.wandb.ai/u/nandeshwar)\
**Post date:** [September 6, 2021, 7:19pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/33 "2021-09-06T19:19:46Z")

</div>

Transfer Learning is the way of using already trained models for different data or tasks. Transfer Learning can be applied in several ways. Also known as _Model Adaptation._

Fine-Tuning is one of the ways of Transfer Learning only. In this, the already trained neural network is further trained on the new dataset. The benefits are 1. Good Neural-Net architecture to start with 2. Weights Initialization is done using the Pre-Trained weights hence the model converges faster.

---

<div class="post-metadata">

**Author:** ![tarkanaguner](https://avatars.discourse-cdn.com/v4/letter/t/9f8e36/32.png) [@tarkanaguner](https://community.wandb.ai/u/tarkanaguner)\
**Post date:** [September 7, 2021, 12:28pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/34 "2021-09-07T12:28:34Z")

</div>

Hi, trying to read and catch up… At page 90 of the book, at 4.4.2, the author talks about reshaping the bikes data. It says: _We see that the rightmost dimension is the number of columns in the original_  
_dataset. Then, in the middle dimension, we have time, split into chunks of 24 sequential hours. In other words, we now have N sequences of L hours in a day, for C channels. To get to our desired N × C × L ordering, we need to transpose the tensor_  
My question is, why the author strictly wants the data in N x C x L format, whereas N x L x C seems more natural…Where each row is hourly data and 17 features are in the columns? Isn’t the NxLxC, the ‘normal’ setup? So what does the auther want to achieve to get features into the rows, rather than keeping them in the columns, so that each hour is in the rows as a sepearate data point??

---

<div class="post-metadata">

**Author:** ![ukamath](https://avatars.discourse-cdn.com/v4/letter/u/b5ac83/32.png) [@ukamath](https://community.wandb.ai/u/ukamath)\
**Post date:** [September 7, 2021, 8:48pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/35 "2021-09-07T20:48:48Z")

</div>

The YouTube video shows Jupyter notebook with more code and tests than what is in the [https://github.com/deep-learning-with-pytorch/dlwpt-code](https://github.com/deep-learning-with-pytorch/dlwpt-code), is there a fork or a separate code base for this?

---

<div class="post-metadata">

**Author:** ![bhutanisanyam1](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/bhutanisanyam1/32/18_2.png) [@bhutanisanyam1](https://community.wandb.ai/u/bhutanisanyam1)\
**Post date:** [September 7, 2021, 10:34pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/36 "2021-09-07T22:34:45Z")

</div>

Thanks for checking! No, this was just via the code on there, which notebook did you notice, has a difference? If I’m on and older version that has more context, I can point you to the version then 😃

---

<div class="post-metadata">

**Author:** ![sahiljuneja](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/sahiljuneja/32/294_2.png) [@sahiljuneja](https://community.wandb.ai/u/sahiljuneja)\
**Post date:** [September 8, 2021, 12:00pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/37 "2021-09-08T12:00:52Z")

</div>

> [@tarkanaguner](#):
>
> My question is, why the author strictly wants the data in N x C x L format, whereas N x L x C seems more natural…Where each row is hourly data and 17 features are in the columns? Isn’t the NxLxC, the ‘normal’ setup? So what does the auther want to achieve to get features into the rows, rather than keeping them in the columns, so that each hour is in the rows as a sepearate data point??

Based on what I have seen, it honestly seems like a personal preference.

N x C gives a window that shows the data across all features during a particular hour of the day. So, (N, C, 3) would be the data for the 3rd hour of the day.

So, if I wanted to get the average of the `temp` for the first date I could do -

```auto
daily_bikes[0, 10 , :].mean()

```

If instead, it was N x L x C, then we look at it differently. N x L would be a window that shows the data for an entire day for a particular feature. So, (N, L, 10) would be the data for the entire day for the `temp` feature.

In this case, the average would be -

```auto
daily_bikes[0, :, 10].mean()

```

As long as we are consistent with what operations we perform and on what dimension, I don’t think there’s much difference here. Alludes more to the discussion on Named Tensors in the 3rd chapter.

It probably only matters how it’s shaped when trying to input into a NN. That’s something I have not tried yet, and choosing either of the above could potentially have an impact at that point, I think.

---

<div class="post-metadata">

**Author:** ![deep\_learner\_007](https://avatars.discourse-cdn.com/v4/letter/d/e9bcb4/32.png) [@deep\_learner\_007](https://community.wandb.ai/u/deep_learner_007)\
**Post date:** [October 3, 2021, 10:59pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/38 "2021-10-03T22:59:54Z")

</div>

I was getting a bit confused with respect to offset and stride. I request you to share a small example if possible.

---

<div class="post-metadata">

**Author:** ![deep\_learner\_007](https://avatars.discourse-cdn.com/v4/letter/d/e9bcb4/32.png) [@deep\_learner\_007](https://community.wandb.ai/u/deep_learner_007)\
**Post date:** [October 3, 2021, 11:03pm UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/39 "2021-10-03T23:03:55Z")

</div>

I found the following link explaining stride: [Pytorch tensor stride - how it works - PyTorch Forums](https://discuss.pytorch.org/t/pytorch-tensor-stride-how-it-works/90537)

---

<div class="post-metadata">

**Author:** ![bhutanisanyam1](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/bhutanisanyam1/32/18_2.png) [@bhutanisanyam1](https://community.wandb.ai/u/bhutanisanyam1)\
**Post date:** [October 4, 2021, 9:21am UTC](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431/40 "2021-10-04T09:21:40Z")

</div>

Sure! I’ll cover this in the beginning of the next call. Thanks for asking 🙂

[Previous page](https://community.wandb.ai/t/2-pytorch-book-thread-sunday-5th-sept-8am-pt/431.md?page=1)
