使用nn.init自定义权重,总是报错RuntimeError: Expected object of scalar type Double but got scalar type Float for

编程小白求大佬拯救!
最近为了毕设在做MobileNet的实验,在训练网络的时候通过nn.init自定义了权重,代码如下:
使用nn.init自定义权重,总是报错RuntimeError: Expected object of scalar type Double but got scalar type Float for
运行之后系统报错:
使用nn.init自定义权重,总是报错RuntimeError: Expected object of scalar type Double but got scalar type Float for
经过调试之后发现原代码里面的m.weight的dtype是tensor.float32,于是百度了很多改格式的方法,tensor.type(),tensor.double()啥的都用过了,还是没有用。有没有大神可以帮忙指条明路(被自己菜哭了)