MCPcopy Create free account
hub / github.com/ActiveVisionLab/DFNet / disable_model_grad

Function disable_model_grad

script/dm/direct_pose_model.py:39–48  ·  view source on GitHub ↗

set whole model to requires_grad=False, this is for nerf model

(model)

Source from the content-addressed store, hash-verified

37from torchvision.utils import save_image
38
39def 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
50def inference_pose_regression(args, data, device, model):
51 """

Callers 1

train_nerf_trackingFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected