in theseus/embodied/motionmodel/quasi_static_pushing_planar.py [0:0]
def _get_J_err_var_(J_D_var_, J_V_var_, J_Vp_var_):
# After einsum, each result is a tensor with size:
# batch_size x se2_dim x 3 x 1
# so that after all terms are summed,
# J_err_var_[b, d] is a (3, 1) vector derivative of
# the b-th batch element of the 3-D error wrt to the
# d-th dimension of the optimization variable.
# At return, we squeeze the trailing dimension, and permute, so that the
# output has shape (batch_size, 3, se2_dim), which is the expected jacobian
# shape.
J_err_var_ = torch.zeros_like(J_V_o1)
if J_D_var_ is not None:
J_err_var_ += torch.einsum(sum_str, J_D_var_, V_exp)
if J_V_var_ is not None:
J_err_var_ += torch.einsum(sum_str, D_exp, J_V_var_)
if J_Vp_var_ is not None:
J_err_var_ += -J_Vp_var_
return J_err_var_.squeeze(3).permute(0, 2, 1)