def _matmul_closure_factory(self, tensor): def closure(rhs_tensor): return torch.matmul(tensor, rhs_tensor) return closure