# What does the .fc.in\_feature mean?

**URL:** <https://discuss.pytorch.org/t/what-does-the-fc-in-feature-mean/4889>\
**Category:** vision\
**Created:** [July 14, 2017, 9:14am UTC](https://discuss.pytorch.org/t/what-does-the-fc-in-feature-mean/4889 "2017-07-14T09:14:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![11115](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/1/eb9ed0/32.png) [@11115](https://discuss.pytorch.org/u/11115)\
**Post date:** [July 14, 2017, 9:14am UTC](https://discuss.pytorch.org/t/what-does-the-fc-in-feature-mean/4889/1 "2017-07-14T09:14:45Z")

</div>

Can anyone tell me what does the following code mean in the [Transfer learning tutorial](http://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html)?

```auto
model_ft = models.resnet18(pretrained=True)
num_ftrs = model_ft.fc.in_features
model_ft.fc = nn.Linear(num_ftrs, 2)

```

I can see that this code is use to adjuest the last fully connected layer to the ‘ant’ and ‘bee’ poblem. But I can’t find anything in the pytorch documents about `.fc.in_feature`, So what to do if I wants to transfer another pre-trained model, say `.vgg19_bn`, to another classification problem?

---

<div class="post-metadata">

**Author:** ![alexis-jacq](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/alexis-jacq/32/180_2.png) [@alexis-jacq](https://discuss.pytorch.org/u/alexis-jacq)\
**Post date:** [July 14, 2017, 9:39am UTC](https://discuss.pytorch.org/t/what-does-the-fc-in-feature-mean/4889/2 "2017-07-14T09:39:28Z")

</div>

in\_feature is the number of inputs for your linear layer:

```python
# constructor of nn.Lienar
def __init__ (self, in_features, out_features, bias=True):
    super(Linear, self). __init__ ()
    self.in_features = in_features # num inputs
    self.out_features = out_features # num outputs
    self.weight = Parameter(torch.Tensor(out_features, in_features))
    if bias:
        self.bias = Parameter(torch.Tensor(out_features))

```

You can still check in the sources: [https://github.com/pytorch/pytorch/blob/master/torch/nn/modules/linear.py](https://github.com/pytorch/pytorch/blob/master/torch/nn/modules/linear.py)

---

<div class="post-metadata">

**Author:** ![11115](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/1/eb9ed0/32.png) [@11115](https://discuss.pytorch.org/u/11115)\
**Post date:** [July 14, 2017, 9:53am UTC](https://discuss.pytorch.org/t/what-does-the-fc-in-feature-mean/4889/3 "2017-07-14T09:53:04Z")

</div>

> [@alexis-jacq](#):
>
> [https://github.com/pytorch/pytorch/blob/master/torch/nn/modules/linear.py](https://github.com/pytorch/pytorch/blob/master/torch/nn/modules/linear.py)

Thank you very much! You helped a lot!

---

<div class="post-metadata">

**Author:** ![FrankZLuffy](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/frankzluffy/32/16707_2.png) [@FrankZLuffy](https://discuss.pytorch.org/u/FrankZLuffy)\
**Post date:** [May 25, 2019, 12:32pm UTC](https://discuss.pytorch.org/t/what-does-the-fc-in-feature-mean/4889/4 "2019-05-25T12:32:25Z")

</div>

model\_ft is a type of \<class ‘torchvision.models.resnet.ResNet’\>.

 ![resnet](https://discuss.pytorch.org/uploads/default/original/2X/d/d0d72cfb9a9d8714ed804c33231abfbc50898299.png)

---

<div class="post-metadata">

**Author:** ![FrankZLuffy](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/frankzluffy/32/16707_2.png) [@FrankZLuffy](https://discuss.pytorch.org/u/FrankZLuffy)\
**Post date:** [May 25, 2019, 12:33pm UTC](https://discuss.pytorch.org/t/what-does-the-fc-in-feature-mean/4889/5 "2019-05-25T12:33:11Z")

</div>

model\_ft.fc is a type of \<class ‘torch.nn.modules.linear.Linear’\>.

 ![linear](https://discuss.pytorch.org/uploads/default/original/2X/c/ce5fbdae24f16b63510726a42c118b50533bb148.png)
