def backward(ctx, grad_output): input, other = ctx.saved_variables grad_input = other.cross(grad_output, ctx.dim) grad_other = grad_output.cross(input, ctx.dim) return grad_input, grad_other, None