Skip to content

.with_buffers are really work? #716

Open
@bwnjnOEI

Description

@bwnjnOEI

I use torch.nn.utils.prune to pruning model, and it generates a mask buffer. However, when I use make_functional_with_buffers, the error is RuntimeError: Only Tensors created explicitly by the user (graph leaves) support the deepcopy protocol at the moment. Is it because of the use of deepcopy, or am I missing something?

My test code as follows:

import torch
import torch.nn as nn
from torch.nn.utils.prune import l1_unstructured
from functorch import make_functional_with_buffers

m = nn.Linear(100,100)
l1_unstructured(m, 'weight', amount=0.5)
print(m.weight_mask.is_leaf)
func, params, buffers = make_functional_with_buffers(m)

Pls, help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionableIt is clear what should be done for this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions