Open
Description
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!