Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cuda_rasterizer-->backward.cu中的361行-->368行中的final_A, final_D,final_D2需要随着循环变化吗? #28

Open
zhuyu2015 opened this issue May 14, 2024 · 2 comments

Comments

@zhuyu2015
Copy link

#else
			dL_dweight += (final_D2 + m_d * m_d * final_A - 2 * m_d * final_D) * dL_dreg;
#endif
			dL_dalpha += dL_dweight - last_dL_dT;
			// propagate the current weight W_{i} to next weight W_{i-1}
			last_dL_dT = dL_dweight * alpha + (1 - alpha) * last_dL_dT;
			float dL_dmd = 2.0f * (T * alpha) * (m_d * final_A - final_D) * dL_dreg;
			dL_dz += dL_dmd * dmd_dd;

尤其367行的final_A和final_D要随循环的变化而变化吗?

@zhuyu2015
Copy link
Author

第367行是这一行:

float dL_dmd = 2.0f * (T * alpha) * (m_d * final_A - final_D) * dL_dreg;

@hbb1
Copy link
Owner

hbb1 commented May 14, 2024

Hi, here is the formulation for back-propagation of the depth-distortion loss:

$$L= \sum_{i=0}^{N-1}\sum_{j=0}^{N-1}w_iw_j(d_i-d_j)^2$$

Now we specifically analyze the $k$-th item and do some simplification,

$$ L_k = \sum_{j=0}^{k-1}w_kw_j(d_k-d_j)^2 + \sum_{i=k+1}^{N-1}w_iw_k(d_i-d_k)^2 $$

$$ L_k = \sum_{j=0}^{k-1}w_kw_j(d_k^2-2d_kd_j + d_j^2) + \sum_{i=k+1}^{N-1}w_iw_k(d_i^2-2d_id_k+d_k^2)$$

factorize the nested composition terms and we have got:
$$dL_k / dw_k = \sum_{j=0}^{k-1}w_j(d_k^2-2d_kd_j+d_j^2) + \sum_{i=k+1}^{N-1}w_i(d_i^2-2d_id_k+d_k^2)$$

$$dL_k / dw_k = D^2-w_kd_k^2 + d_k^2(A_k-w_k) - 2d_k(\sum_{j=0}^{k-1}w_jd_j + \sum_{i=k+1}^{N-1}w_id_i +w_kd_k -w_kd_k) = D^2 +d_k^2A-2d_kD $$

$$dL_k / dd_k = 2(\sum_{j=0}^{k-1}w_kw_j(d_k-d_j) + \sum_{i=k+1}^{N-1}w_iw_k(d_k-d_i)) = 2(w_k(d_k(A-w_k) - (D-d_kw_k))) = 2(w_k(d_kA - D))$$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants