MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / closure

Method closure

detrsmpl/models/registrants/smplify.py:350–375  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

348 for iter_idx in range(num_iter):
349
350 def closure():
351 optimizer.zero_grad()
352 betas_video = self._expand_betas(body_pose.shape[0], betas)
353
354 loss_dict = self.evaluate(
355 global_orient=global_orient,
356 body_pose=body_pose,
357 betas=betas_video,
358 transl=transl,
359 keypoints2d=keypoints2d,
360 keypoints2d_conf=keypoints2d_conf,
361 keypoints2d_weight=keypoints2d_weight,
362 keypoints3d=keypoints3d,
363 keypoints3d_conf=keypoints3d_conf,
364 keypoints3d_weight=keypoints3d_weight,
365 joint_prior_weight=joint_prior_weight,
366 shape_prior_weight=shape_prior_weight,
367 smooth_loss_weight=smooth_loss_weight,
368 pose_prior_weight=pose_prior_weight,
369 pose_reg_weight=pose_reg_weight,
370 limb_length_weight=limb_length_weight,
371 joint_weights=joint_weights)
372
373 loss = loss_dict['total_loss']
374 loss.backward()
375 return loss
376
377 loss = optimizer.step(closure)
378 if iter_idx > 0 and pre_loss is not None and ftol > 0:

Callers

nothing calls this directly

Calls 3

_expand_betasMethod · 0.95
evaluateMethod · 0.95
backwardMethod · 0.80

Tested by

no test coverage detected