We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Change default value of eps in FrozenBatchNorm to match BatchNorm
## ❓ Questions and Help
Hello
Loss is nan error occurs when I learn fast rcnn with resnext101 backbone
My code is as follows
```python
backbone = resnet_fpn_backbone('resnext101_32x8d', pretrained=True)
model = FasterRCNN(backbone, num_classes)
in_features = model.roi_heads.box_predictor.cls_score.in_features
model.roi_heads.box_predictor = FastRCNNPredictor(in_features, num_classes)
```

error message
```
Epoch: [0]  [   0/7208]  eta: 1:27:42  lr: 0.000040  loss: 40613806080.0000 (40613806080.0000)  loss_box_reg: 7979147264.0000 (7979147264.0000)  loss_classifier: 11993160704.0000 (11993160704.0000)  loss_objectness: 9486380032.0000 (9486380032.0000)  loss_rpn_box_reg: 11155118080.0000 (11155118080.0000)  time: 0.7301  data: 0.4106  max mem: 1241
Loss is nan, stopping training
```

When i change the backbone to resnet50 and resnet152, no error occrus.
### Please note that this issue tracker is not a help form and this issue will be closed.

We have a set of [listed resources available on the website](https://pytorch.org/resources). Our primary means of support is our discussion forum:

- [Discussion Forum](https://discuss.pytorch.org/)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `torchvision/ops/misc.py`
Content:
```
1 """
2 helper class that supports empty tensors on some nn functions.
3 
4 Ideally, add support directly in PyTorch to empty tensors in
5 those functions.
6 
7 This can be removed once https://github.com/pytorch/pytorch/issues/12013
8 is implemented
9 """
10 
11 import warnings
12 import torch
13 from torch import Tensor, Size
14 from torch.jit.annotations import List, Optional, Tuple
15 
16 
17 class Conv2d(torch.nn.Conv2d):
18     def __init__(self, *args, **kwargs):
19         super().__init__(*args, **kwargs)
20         warnings.warn(
21             "torchvision.ops.misc.Conv2d is deprecated and will be "
22             "removed in future versions, use torch.nn.Conv2d instead.", FutureWarning)
23 
24 
25 class ConvTranspose2d(torch.nn.ConvTranspose2d):
26     def __init__(self, *args, **kwargs):
27         super().__init__(*args, **kwargs)
28         warnings.warn(
29             "torchvision.ops.misc.ConvTranspose2d is deprecated and will be "
30             "removed in future versions, use torch.nn.ConvTranspose2d instead.", FutureWarning)
31 
32 
33 class BatchNorm2d(torch.nn.BatchNorm2d):
34     def __init__(self, *args, **kwargs):
35         super().__init__(*args, **kwargs)
36         warnings.warn(
37             "torchvision.ops.misc.BatchNorm2d is deprecated and will be "
38             "removed in future versions, use torch.nn.BatchNorm2d instead.", FutureWarning)
39 
40 
41 interpolate = torch.nn.functional.interpolate
42 
43 
44 # This is not in nn
45 class FrozenBatchNorm2d(torch.nn.Module):
46     """
47     BatchNorm2d where the batch statistics and the affine parameters
48     are fixed
49     """
50 
51     def __init__(
52         self,
53         num_features: int,
54         eps: float = 0.,
55         n: Optional[int] = None,
56     ):
57         # n=None for backward-compatibility
58         if n is not None:
59             warnings.warn("`n` argument is deprecated and has been renamed `num_features`",
60                           DeprecationWarning)
61             num_features = n
62         super(FrozenBatchNorm2d, self).__init__()
63         self.eps = eps
64         self.register_buffer("weight", torch.ones(num_features))
65         self.register_buffer("bias", torch.zeros(num_features))
66         self.register_buffer("running_mean", torch.zeros(num_features))
67         self.register_buffer("running_var", torch.ones(num_features))
68 
69     def _load_from_state_dict(
70         self,
71         state_dict: dict,
72         prefix: str,
73         local_metadata: dict,
74         strict: bool,
75         missing_keys: List[str],
76         unexpected_keys: List[str],
77         error_msgs: List[str],
78     ):
79         num_batches_tracked_key = prefix + 'num_batches_tracked'
80         if num_batches_tracked_key in state_dict:
81             del state_dict[num_batches_tracked_key]
82 
83         super(FrozenBatchNorm2d, self)._load_from_state_dict(
84             state_dict, prefix, local_metadata, strict,
85             missing_keys, unexpected_keys, error_msgs)
86 
87     def forward(self, x: Tensor) -> Tensor:
88         # move reshapes to the beginning
89         # to make it fuser-friendly
90         w = self.weight.reshape(1, -1, 1, 1)
91         b = self.bias.reshape(1, -1, 1, 1)
92         rv = self.running_var.reshape(1, -1, 1, 1)
93         rm = self.running_mean.reshape(1, -1, 1, 1)
94         scale = w * (rv + self.eps).rsqrt()
95         bias = b - rm * scale
96         return x * scale + bias
97 
98     def __repr__(self) -> str:
99         return f"{self.__class__.__name__}({self.weight.shape[0]}, eps={self.eps})"
100
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/torchvision/ops/misc.py b/torchvision/ops/misc.py
--- a/torchvision/ops/misc.py
+++ b/torchvision/ops/misc.py
@@ -51,7 +51,7 @@
     def __init__(
         self,
         num_features: int,
-        eps: float = 0.,
+        eps: float = 1e-5,
         n: Optional[int] = None,
     ):
         # n=None for backward-compatibility

{"golden_diff": "diff --git a/torchvision/ops/misc.py b/torchvision/ops/misc.py\n--- a/torchvision/ops/misc.py\n+++ b/torchvision/ops/misc.py\n@@ -51,7 +51,7 @@\n     def __init__(\n         self,\n         num_features: int,\n-        eps: float = 0.,\n+        eps: float = 1e-5,\n         n: Optional[int] = None,\n     ):\n         # n=None for backward-compatibility\n", "issue": "Change default value of eps in FrozenBatchNorm to match BatchNorm\n## \u2753 Questions and Help\r\nHello\r\nLoss is nan error occurs when I learn fast rcnn with resnext101 backbone\r\nMy code is as follows\r\n```python\r\nbackbone = resnet_fpn_backbone('resnext101_32x8d', pretrained=True)\r\nmodel = FasterRCNN(backbone, num_classes)\r\nin_features = model.roi_heads.box_predictor.cls_score.in_features\r\nmodel.roi_heads.box_predictor = FastRCNNPredictor(in_features, num_classes)\r\n```\r\n\r\nerror message\r\n```\r\nEpoch: [0]  [   0/7208]  eta: 1:27:42  lr: 0.000040  loss: 40613806080.0000 (40613806080.0000)  loss_box_reg: 7979147264.0000 (7979147264.0000)  loss_classifier: 11993160704.0000 (11993160704.0000)  loss_objectness: 9486380032.0000 (9486380032.0000)  loss_rpn_box_reg: 11155118080.0000 (11155118080.0000)  time: 0.7301  data: 0.4106  max mem: 1241\r\nLoss is nan, stopping training\r\n```\r\n\r\nWhen i change the backbone to resnet50 and resnet152, no error occrus.\r\n### Please note that this issue tracker is not a help form and this issue will be closed.\r\n\r\nWe have a set of [listed resources available on the website](https://pytorch.org/resources). Our primary means of support is our discussion forum:\r\n\r\n- [Discussion Forum](https://discuss.pytorch.org/)\r\n\n", "before_files": [{"content": "\"\"\"\nhelper class that supports empty tensors on some nn functions.\n\nIdeally, add support directly in PyTorch to empty tensors in\nthose functions.\n\nThis can be removed once https://github.com/pytorch/pytorch/issues/12013\nis implemented\n\"\"\"\n\nimport warnings\nimport torch\nfrom torch import Tensor, Size\nfrom torch.jit.annotations import List, Optional, Tuple\n\n\nclass Conv2d(torch.nn.Conv2d):\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        warnings.warn(\n            \"torchvision.ops.misc.Conv2d is deprecated and will be \"\n            \"removed in future versions, use torch.nn.Conv2d instead.\", FutureWarning)\n\n\nclass ConvTranspose2d(torch.nn.ConvTranspose2d):\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        warnings.warn(\n            \"torchvision.ops.misc.ConvTranspose2d is deprecated and will be \"\n            \"removed in future versions, use torch.nn.ConvTranspose2d instead.\", FutureWarning)\n\n\nclass BatchNorm2d(torch.nn.BatchNorm2d):\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        warnings.warn(\n            \"torchvision.ops.misc.BatchNorm2d is deprecated and will be \"\n            \"removed in future versions, use torch.nn.BatchNorm2d instead.\", FutureWarning)\n\n\ninterpolate = torch.nn.functional.interpolate\n\n\n# This is not in nn\nclass FrozenBatchNorm2d(torch.nn.Module):\n    \"\"\"\n    BatchNorm2d where the batch statistics and the affine parameters\n    are fixed\n    \"\"\"\n\n    def __init__(\n        self,\n        num_features: int,\n        eps: float = 0.,\n        n: Optional[int] = None,\n    ):\n        # n=None for backward-compatibility\n        if n is not None:\n            warnings.warn(\"`n` argument is deprecated and has been renamed `num_features`\",\n                          DeprecationWarning)\n            num_features = n\n        super(FrozenBatchNorm2d, self).__init__()\n        self.eps = eps\n        self.register_buffer(\"weight\", torch.ones(num_features))\n        self.register_buffer(\"bias\", torch.zeros(num_features))\n        self.register_buffer(\"running_mean\", torch.zeros(num_features))\n        self.register_buffer(\"running_var\", torch.ones(num_features))\n\n    def _load_from_state_dict(\n        self,\n        state_dict: dict,\n        prefix: str,\n        local_metadata: dict,\n        strict: bool,\n        missing_keys: List[str],\n        unexpected_keys: List[str],\n        error_msgs: List[str],\n    ):\n        num_batches_tracked_key = prefix + 'num_batches_tracked'\n        if num_batches_tracked_key in state_dict:\n            del state_dict[num_batches_tracked_key]\n\n        super(FrozenBatchNorm2d, self)._load_from_state_dict(\n            state_dict, prefix, local_metadata, strict,\n            missing_keys, unexpected_keys, error_msgs)\n\n    def forward(self, x: Tensor) -> Tensor:\n        # move reshapes to the beginning\n        # to make it fuser-friendly\n        w = self.weight.reshape(1, -1, 1, 1)\n        b = self.bias.reshape(1, -1, 1, 1)\n        rv = self.running_var.reshape(1, -1, 1, 1)\n        rm = self.running_mean.reshape(1, -1, 1, 1)\n        scale = w * (rv + self.eps).rsqrt()\n        bias = b - rm * scale\n        return x * scale + bias\n\n    def __repr__(self) -> str:\n        return f\"{self.__class__.__name__}({self.weight.shape[0]}, eps={self.eps})\"\n", "path": "torchvision/ops/misc.py"}], "after_files": [{"content": "\"\"\"\nhelper class that supports empty tensors on some nn functions.\n\nIdeally, add support directly in PyTorch to empty tensors in\nthose functions.\n\nThis can be removed once https://github.com/pytorch/pytorch/issues/12013\nis implemented\n\"\"\"\n\nimport warnings\nimport torch\nfrom torch import Tensor, Size\nfrom torch.jit.annotations import List, Optional, Tuple\n\n\nclass Conv2d(torch.nn.Conv2d):\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        warnings.warn(\n            \"torchvision.ops.misc.Conv2d is deprecated and will be \"\n            \"removed in future versions, use torch.nn.Conv2d instead.\", FutureWarning)\n\n\nclass ConvTranspose2d(torch.nn.ConvTranspose2d):\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        warnings.warn(\n            \"torchvision.ops.misc.ConvTranspose2d is deprecated and will be \"\n            \"removed in future versions, use torch.nn.ConvTranspose2d instead.\", FutureWarning)\n\n\nclass BatchNorm2d(torch.nn.BatchNorm2d):\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        warnings.warn(\n            \"torchvision.ops.misc.BatchNorm2d is deprecated and will be \"\n            \"removed in future versions, use torch.nn.BatchNorm2d instead.\", FutureWarning)\n\n\ninterpolate = torch.nn.functional.interpolate\n\n\n# This is not in nn\nclass FrozenBatchNorm2d(torch.nn.Module):\n    \"\"\"\n    BatchNorm2d where the batch statistics and the affine parameters\n    are fixed\n    \"\"\"\n\n    def __init__(\n        self,\n        num_features: int,\n        eps: float = 1e-5,\n        n: Optional[int] = None,\n    ):\n        # n=None for backward-compatibility\n        if n is not None:\n            warnings.warn(\"`n` argument is deprecated and has been renamed `num_features`\",\n                          DeprecationWarning)\n            num_features = n\n        super(FrozenBatchNorm2d, self).__init__()\n        self.eps = eps\n        self.register_buffer(\"weight\", torch.ones(num_features))\n        self.register_buffer(\"bias\", torch.zeros(num_features))\n        self.register_buffer(\"running_mean\", torch.zeros(num_features))\n        self.register_buffer(\"running_var\", torch.ones(num_features))\n\n    def _load_from_state_dict(\n        self,\n        state_dict: dict,\n        prefix: str,\n        local_metadata: dict,\n        strict: bool,\n        missing_keys: List[str],\n        unexpected_keys: List[str],\n        error_msgs: List[str],\n    ):\n        num_batches_tracked_key = prefix + 'num_batches_tracked'\n        if num_batches_tracked_key in state_dict:\n            del state_dict[num_batches_tracked_key]\n\n        super(FrozenBatchNorm2d, self)._load_from_state_dict(\n            state_dict, prefix, local_metadata, strict,\n            missing_keys, unexpected_keys, error_msgs)\n\n    def forward(self, x: Tensor) -> Tensor:\n        # move reshapes to the beginning\n        # to make it fuser-friendly\n        w = self.weight.reshape(1, -1, 1, 1)\n        b = self.bias.reshape(1, -1, 1, 1)\n        rv = self.running_var.reshape(1, -1, 1, 1)\n        rm = self.running_mean.reshape(1, -1, 1, 1)\n        scale = w * (rv + self.eps).rsqrt()\n        bias = b - rm * scale\n        return x * scale + bias\n\n    def __repr__(self) -> str:\n        return f\"{self.__class__.__name__}({self.weight.shape[0]}, eps={self.eps})\"\n", "path": "torchvision/ops/misc.py"}]}