set whole model to requires_grad=False, this is for nerf model
(model)
| 37 | from torchvision.utils import save_image |
| 38 | |
| 39 | def disable_model_grad(model): |
| 40 | ''' set whole model to requires_grad=False, this is for nerf model ''' |
| 41 | print("disable_model_grad...") |
| 42 | for module in model.modules(): |
| 43 | # print("this is a layer:", module) |
| 44 | if hasattr(module, 'weight'): |
| 45 | module.weight.requires_grad_(False) |
| 46 | if hasattr(module, 'bias'): |
| 47 | module.bias.requires_grad_(False) |
| 48 | return model |
| 49 | |
| 50 | def inference_pose_regression(args, data, device, model): |
| 51 | """ |
no outgoing calls
no test coverage detected