# Why adaptive\_avg\_pool1d became adaptive\_avg\_pool2d in make\_fx?

**URL:** <https://discuss.pytorch.org/t/why-adaptive-avg-pool1d-became-adaptive-avg-pool2d-in-make-fx/219280>\
**Category:** FX (Functional Transformations)\
**Created:** [April 21, 2025, 1:25am UTC](https://discuss.pytorch.org/t/why-adaptive-avg-pool1d-became-adaptive-avg-pool2d-in-make-fx/219280 "2025-04-21T01:25:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![heshuju](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/heshuju/32/76271_2.png) [@heshuju](https://discuss.pytorch.org/u/heshuju)\
**Post date:** [April 21, 2025, 1:25am UTC](https://discuss.pytorch.org/t/why-adaptive-avg-pool1d-became-adaptive-avg-pool2d-in-make-fx/219280/1 "2025-04-21T01:25:29Z")

</div>

I need to use the make\_fx interface to output aten ops and convert them into corresponding torch diaclects. But I found that make\_fx will replace some ops. How does this happen and how should I solve it?

```auto
import torch
import os
from torch.fx.experimental.proxy_tensor import make_fx
print("os:pid:", os.getpid())
class Aten_Adaptive_avg_pool1d(torch.nn.Module):
    def __init__ (self, output_size):
        super(). __init__ ()
        self.output_size=output_size
    def forward(self, self_):
        return torch.ops.aten.adaptive_avg_pool1d(self_, output_size=self.output_size)

if __name__ == " __main__":
    model = Aten_Adaptive_avg_pool1d(3)
    model.train(False)
    model = model.eval()
    #"adaptive_avg_pool1d": {"inputs": 1, "outputs": 1, "attrs": {"output_size": [3]}, "input_shapes": ["1,32,128"]},
    input = torch.randn(1,32,128)
    traced_model = make_fx(model)(input)
    print(traced_model.graph)
    pass

```

and It print out:

```auto
graph():
    %arg0_1 : [num_users=1] = placeholder[target=arg0_1]
    %unsqueeze : [num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%arg0_1, -2), kwargs = {})
    %_adaptive_avg_pool2d : [num_users=1] = call_function[target=torch.ops.aten._adaptive_avg_pool2d.default](args = (%unsqueeze, [1, 3]), kwargs = {})
    %squeeze : [num_users=1] = call_function[target=torch.ops.aten.squeeze.dim](args = (%_adaptive_avg_pool2d, -2), kwargs = {})
    return squeeze

```

I need some help, thanks~

---

<div class="post-metadata">

**Author:** ![heshuju](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/heshuju/32/76271_2.png) [@heshuju](https://discuss.pytorch.org/u/heshuju)\
**Post date:** [April 21, 2025, 1:37am UTC](https://discuss.pytorch.org/t/why-adaptive-avg-pool1d-became-adaptive-avg-pool2d-in-make-fx/219280/2 "2025-04-21T01:37:03Z")

</div>

I find adaptive\_avg\_pool1d expand it to adaptive\_avg\_pool2d.in cpp library .  
How does make\_fx trace back to function calls in the cpp library?

> <https://github.com/pytorch/pytorch/blob/470132c6a10d1279ee66a43778edb91f1032512f/aten/src/ATen/native/Pooling.cpp#L43>
