Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

No effect after “ fuse_bn_recursively” #7

@Ironteen

Description

@Ironteen

I load mobileNet v2 and operate it by fuse_bn_recursively function, then print the network strutures of this two model, but I found that the bn_fusion net is the same as the initial net, is it because of my misoperation?
`
import torch
from bn_fusion import fuse_bn_recursively
from pytorchcv.model_provider import get_model as ptcv_get_model

if name == 'main':

net = ptcv_get_model('mobilenetv2_w1', pretrained=True)

net1 = fuse_bn_recursively(net)
net1.eval()

net_dict1 = {}
for idx,(name,param) in enumerate(net.named_parameters()):
    net_dict1[name] = param

net_dict2 = {}
for idx,(name,param) in enumerate(net1.named_parameters()):
    net_dict2[name] = param
names = net_dict1.keys()

diff_cnt = 0
for name in names:
    if net_dict1[name].shape!=net_dict2[name].shape:
        diff_cnt +=1
print("diff params:",diff_cnt)

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions