论文阅读笔记:Denoising Diffusion Implicit Models (2)

0、快速访问

论文阅读笔记:Denoising Diffusion Implicit Models (1)
论文阅读笔记:Denoising Diffusion Implicit Models (2)
论文阅读笔记:Denoising Diffusion Implicit Models (3)
论文阅读笔记:Denoising Diffusion Implicit Models (4)

3、非马尔可夫正向加噪过程

与DDPM中的正向加噪过程不同,DDIM的加噪过程是非马尔可夫的,按照论文中的表述,如公式(1) 和(2)所示。
q σ ( x 1 : T ∣ x 0 ) : = q σ ( x T ∣ x 0 ) ∏ t = 2 T q σ ( x t − 1 ∣ x t , x 0 ) \begin{equation} \begin{split} q_{\sigma}(x_{1:T}|x_0):&=q_{\sigma}(x_T|x_0)\prod_{t=2}^{T}q_{\sigma}(x_{t-1}|x_t,x_0) \end{split} \end{equation} qσ(x1:Tx0):=qσ(xTx0)t=2Tqσ(xt1xt,x0)
式中
q σ ( x T ∣ x 0 ) = N ( x T ; α T x 0 , ( 1 − α T ) I ) ⇔ x T = α T ⋅ x 0 + 1 − α T ⋅ z ( z 为标准正态分布 ) q σ ( x t − 1 ∣ x t , x 0 ) = N ( x t − 1 ; 1 − α t − 1 − σ t 2 1 − α t ⋅ x t + [ α t − 1 − α t ⋅ ( 1 − α t − 1 − σ t 2 ) 1 − α t ] ⋅ x 0 ⏟ 令其等于 = μ ( x t , x 0 ) , σ t 2 I ) = N ( x t − 1 ; μ ( x t , x 0 ) , σ t 2 I ) \begin{equation} \begin{split} q_{\sigma}(x_T|x_0)&=N(x_T;\sqrt{\alpha_T}x_0,(1-\alpha_T)I)\Leftrightarrow x_T=\sqrt{\alpha_T}\cdot x_0+\sqrt{1-\alpha_T}\cdot z(z为标准正态分布) \\ q_{\sigma}(x_{t-1}|x_t,x_0)&=N\Bigg(x_{t-1};\underbrace{\sqrt{\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}}}\cdot x_t+ \bigg[\sqrt{\alpha_{t-1}}- \frac{\sqrt{ \alpha_t\cdot (1-\alpha_{t-1}-\sigma_t^2} )}{\sqrt{1-\alpha_t}} \bigg] \cdot x_0}_{令其等于=\mu(x_t,x_0)} ,\sigma_t^2 I\Bigg) \\ &=N\Bigg(x_{t-1};\mu(x_t,x_0) ,\sigma_t^2 I\Bigg) \\ \end{split} \end{equation} qσ(xTx0)qσ(xt1xt,x0)=N(xT;αT x0,(1αT)I)xT=αT x0+1αT z(z为标准正态分布)=N(xt1;令其等于=μ(xt,x0) 1αt1αt1σt2 xt+[αt1 1αt αt(1αt1σt2 )]x0,σt2I)=N(xt1;μ(xt,x0),σt2I)
下图展示了这个加噪过程
在这里插入图片描述

对于这个采样过程,首先证明以下引理:
Lemma 1: q σ ( x t ∣ x 0 ) = N ( x t ; α t x 0 , ( 1 − α t ) I ) ⇔ x t = α t ⋅ x 0 + 1 − α t ⋅ z \begin{equation} \begin{split} \text{Lemma 1}:q_{\sigma}(x_t|x_0)&=N(x_t;\sqrt{\alpha_t} x_0,(1-\alpha_t)I) \\ \Leftrightarrow x_t&=\sqrt{\alpha_t}\cdot x_0+\sqrt{1-\alpha_t}\cdot z \\ \end{split} \end{equation} Lemma 1qσ(xtx0)xt=N(xt;αt x0,(1αt)I)=αt x0+1αt z
使用数学归纳法证明Lemma 1,方法分为3步,如所示

  1. t = T t=T t=T时, t = T t=T t=T时, q σ ( x T ∣ x 0 ) q_{\sigma}(x_T|x_0) qσ(xTx0)满足 x T = α T ⋅ x 0 + 1 − α T ⋅ z x_T=\sqrt{\alpha_T}\cdot x_0+\sqrt{1-\alpha_T}\cdot z xT=αT x0+1αT z,符合Lemma 1。
  2. 假设 t = t t=t t=t q σ ( x t ∣ x 0 ) q_{\sigma}(x_t|x_0) qσ(xtx0)满足Lemma 1,即 q σ ( x t ∣ x 0 ) = N ( x t ; α t x 0 , ( 1 − α t ) ) q_{\sigma}(x_t|x_0)=N\big(x_t;\sqrt{\alpha_t} x_0,(1-\alpha_t)\big) qσ(xtx0)=N(xt;αt x0,(1αt))
  3. 这一步需要证明:当 t = t − 1 t=t-1 t=t1时,由于 q σ ( x t − 1 ∣ x 0 ) q_{\sigma}(x_{t-1}|x_0) qσ(xt1x0)也满足Lemma 1。这个证明过程有两种方法。
    方法1:
    q σ ( x t − 1 ∣ x 0 ) q_{\sigma}(x_{t-1}|x_0) qσ(xt1x0) q σ ( x t − 1 , x t ∣ x 0 ) q_{\sigma}(x_{t-1},x_t|x_0) qσ(xt1,xtx0)的边缘分布,因此 q σ ( x t − 1 ∣ x 0 ) q_{\sigma}(x_{t-1}|x_0) qσ(xt1x0)满足公式(4)。
    q σ ( x t − 1 ∣ x 0 ) = ∫ q σ ( x t − 1 , x t ∣ x 0 ) ⋅ d x t = ∫ q σ ( x t ∣ x 0 ) ⋅ q σ ( x t − 1 ∣ x t , x 0 ) ⋅ d x t \begin{equation} \begin{split} q_{\sigma}(x_{t-1}|x_0)&= \int q_{\sigma}(x_{t-1},x_t|x_0) \cdot d{x_t}\\ &=\int q_{\sigma}(x_t|x_0)\cdot q_{\sigma}(x_{t-1}|x_t,x_0) \cdot d{x_t} \end{split} \end{equation} qσ(xt1x0)=qσ(xt1,xtx0)dxt=qσ(xtx0)qσ(xt1xt,x0)dxt
    q σ ( x t − 1 ∣ x 0 ) q_{\sigma}(x_{t-1}|x_0) qσ(xt1x0)表示:在给定 x 0 x_0 x0的条件下, x t − 1 x_{t-1} xt1的分布。 x t − 1 x_{t-1} xt1是一个高斯分布,并且设其均值和方差分别为 μ \mu μ σ \sigma σ,其计算过程分别如公式(5)和公式(6)所示。
    μ = E ( q σ ( x t − 1 ∣ x 0 ) ) = ∫ x t − 1 ⋅ q σ ( x t − 1 ∣ x 0 ) ⋅ d x t − 1 = ∫ x t − 1 ⋅ ( ∫ q σ ( x t ∣ x 0 ) ⋅ q σ ( x t − 1 ∣ x t , x 0 ) ⋅ d x t ) ⋅ d x t − 1 = ∬ x t − 1 ⋅ q σ ( x t ∣ x 0 ) ⋅ q σ ( x t − 1 ∣ x t , x 0 ) ⋅ d x t d x t − 1 = ∫ ( ∫ x t − 1 ⋅ q σ ( x t − 1 ∣ x t , x 0 ) ⋅ d x t − 1 ) q σ ( x t ∣ x 0 ) ⋅ d x t = ∫ μ ( x t , x 0 ) ⋅ q σ ( x t ∣ x 0 ) ⋅ d x t = E x t ∼ q σ ( x t ∣ x 0 ) ( μ ( x t , x 0 ) ) = E x t ∼ q σ ( x t ∣ x 0 ) ( 1 − α t − 1 − σ t 2 1 − α t ⋅ x t + [ α t − 1 − α t ⋅ ( 1 − α t − 1 − σ t 2 ) 1 − α t ] ⋅ x 0 ) = 1 − α t − 1 − σ t 2 1 − α t ⋅ E x t ∼ q σ ( x t ∣ x 0 ) ( x t ) ⏟ = α t ⋅ x 0 + [ α t − 1 − α t ⋅ ( 1 − α t − 1 − σ t 2 ) 1 − α t ] ⋅ x 0 = 1 − α t − 1 − σ t 2 1 − α t ⋅ x 0 + [ α t − 1 − α t ⋅ ( 1 − α t − 1 − σ t 2 ) 1 − α t ] ⋅ x 0 = α t − 1 ⋅ x 0 \begin{equation} \begin{split} \mu&=E\big(q_{\sigma}(x_{t-1}|x_0)\big)\\ &=\int x_{t-1}\cdot q_{\sigma}(x_{t-1}|x_0) \cdot dx_{t-1} \\ &=\int x_{t-1} \cdot \Bigg( \int q_{\sigma}(x_t|x_0)\cdot q_{\sigma}(x_{t-1}|x_t,x_0) \cdot d{x_t}\Bigg)\cdot dx_{t-1} \\ &= \iint x_{t-1}\cdot q_\sigma(x_t|x_0)\cdot q_{\sigma}(x_{t-1}|x_t,x_0) \cdot dx_t dx_{t-1} \\ &=\int \Big(\int x_{t-1}\cdot q_{\sigma}(x_{t-1}|x_t,x_0) \cdot dx_{t-1}\Big) q_\sigma(x_t|x_0)\cdot dx_t \\ &=\int \mu(x_t,x_0)\cdot q_\sigma(x_t|x_0)\cdot dx_t \\ &=E_{x_t\sim q_{\sigma}(x_t|x_0)}\Big(\mu(x_t,x_0)\Big)\\ &=E_{x_t\sim q_{\sigma}(x_t|x_0)}\Bigg(\sqrt{\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}}}\cdot x_t+ \bigg[\sqrt{\alpha_{t-1}}- \frac{\sqrt{ \alpha_t\cdot (1-\alpha_{t-1}-\sigma_t^2} )}{\sqrt{1-\alpha_t}} \bigg] \cdot x_0\Bigg) \\ &=\sqrt{\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}}}\cdot \underbrace{E_{x_t\sim q_{\sigma}(x_t|x_0)}(x_t)}_{=\sqrt{\alpha_t}\cdot x_0}+\bigg[\sqrt{\alpha_{t-1}}- \frac{\sqrt{ \alpha_t\cdot (1-\alpha_{t-1}-\sigma_t^2} )}{\sqrt{1-\alpha_t}} \bigg] \cdot x_0 \\ &=\sqrt{\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}}}\cdot x_0+\bigg[\sqrt{\alpha_{t-1}}- \frac{\sqrt{ \alpha_t\cdot (1-\alpha_{t-1}-\sigma_t^2} )}{\sqrt{1-\alpha_t}} \bigg] \cdot x_0 \\ &=\sqrt{\alpha_{t-1}}\cdot x_0 \end{split} \end{equation} μ=E(qσ(xt1x0))=xt1qσ(xt1x0)dxt1=xt1(qσ(xtx0)qσ(xt1xt,x0)dxt)dxt1=xt1qσ(xtx0)qσ(xt1xt,x0)dxtdxt1=(xt1qσ(xt1xt,x0)dxt1)qσ(xtx0)dxt=μ(xt,x0)qσ(xtx0)dxt=Extqσ(xtx0)(μ(xt,x0))=Extqσ(xtx0)(1αt1αt1σt2 xt+[αt1 1αt αt(1αt1σt2 )]x0)=1αt1αt1σt2 =αt x0 Extqσ(xtx0)(xt)+[αt1 1αt αt(1αt1σt2 )]x0=1αt1αt1σt2 x0+[αt1 1αt αt(1αt1σt2 )]x0=αt1 x0
    σ 2 = V a r ( q σ ( x t − 1 ∣ x 0 ) ) = ∫ ( x t − 1 − μ ) 2 ⋅ q σ ( x t − 1 ∣ x 0 ) ⋅ d x t − 1 = ∫ ( x t − 1 2 − 2 μ ⋅ x t − 1 + μ 2 ) ⋅ ( ∫ q σ ( x t ∣ x 0 ) ⋅ q σ ( x t − 1 ∣ x t , x 0 ) ⋅ d x t ) ⋅ d x t − 1 = ∫ ∫ ( x t − 1 2 − 2 μ ⋅ x t − 1 + μ 2 ) ⋅ q σ ( x t ∣ x 0 ) ⋅ q σ ( x t − 1 ∣ x t , x 0 ) ⋅ d x t ⋅ d x t − 1 = ∬ x t − 1 2 ⋅ q σ ( x t ∣ x 0 ) ⋅ q σ ( x t − 1 ∣ x t , x 0 ) ⋅ d x t ⋅ d x t − 1 − ∬ 2 μ ⋅ x t − 1 ⋅ q σ ( x t ∣ x 0 ) ⋅ q σ ( x t − 1 ∣ x t , x 0 ) ⋅ d x t ⋅ d x t − 1 + ∬ μ 2 ⋅ q σ ( x t ∣ x 0 ) ⋅ q σ ( x t − 1 ∣ x t , x 0 ) ⋅ d x t ⋅ d x t − 1 = ∫ ( ∫ x t − 1 2 ⋅ q σ ( x t − 1 ∣ x t , x 0 ) ⋅ d x t − 1 ) ⏟ = E ( x t − 1 2 ) = μ ( x t , x 0 ) 2 + σ t 2 ⋅ q σ ( x t ∣ x 0 ) ⋅ d x t − 2 ⋅ μ ∫ ( ∫ x t − 1 ⋅ q σ ( x t − 1 ∣ x t , x 0 ) ⋅ d x t − 1 ) ⏟ = E ( x t − 1 ) = μ ( x t , x 0 ) ⋅ q σ ( x t ∣ x 0 ) ⋅ d x t + μ 2 ⋅ ∬ q σ ( x t ∣ x 0 ) ⋅ q σ ( x t − 1 ∣ x t , x 0 ) ⋅ d x t ⋅ d x t − 1 ⏟ = 1 = ∫ ( μ ( x t , x 0 ) 2 + σ t 2 ) ⋅ q σ ( x t ∣ x 0 ) ⋅ d x t − 2 ⋅ μ ∫ μ ( x t , x 0 ) ⋅ q σ ( x t ∣ x 0 ) ⋅ d x t ⏟ = μ + μ 2 = ∫ μ ( x t , x 0 ) 2 ⋅ q σ ( x t ∣ x 0 ) ⋅ d x t + σ t 2 ⋅ ∫ q σ ( x t ∣ x 0 ) ⋅ d x t ⏟ = 1 − 2 ⋅ μ 2 + μ 2 = ∫ ( 1 − α t − 1 − σ t 2 1 − α t ⋅ x t + [ α t − 1 − α t ⋅ ( 1 − α t − 1 − σ t 2 ) 1 − α t ] ⋅ x 0 ⏟ 为定值,设为 A ) 2 ⋅ q σ ( x t ∣ x 0 ) ⋅ d x t + σ t 2 − μ 2 = ∫ ( 1 − α t − 1 − σ t 2 1 − α t ⋅ x t + A ) 2 ⋅ q σ ( x t ∣ x 0 ) ⋅ d x t + σ t 2 − μ 2 = ∫ ( 1 − α t − 1 − σ t 2 1 − α t ⋅ x t 2 + 2 ⋅ A ⋅ 1 − α t − 1 − σ t 2 1 − α t ⋅ x t + A 2 ) 2 ⋅ q σ ( x t ∣ x 0 ) ⋅ d x t + σ t 2 − μ 2 = 1 − α t − 1 − σ t 2 1 − α t ⋅ ∫ x t 2 ⋅ q σ ( x t ∣ x 0 ) ⋅ d x t ⏟ = E x t ∼ q σ ( x t ∣ x 0 ) ( x t 2 ) + 2 ⋅ A ⋅ 1 − α t − 1 − σ t 2 1 − α t ⋅ ∫ x t ⋅ q σ ( x t ∣ x 0 ) ⋅ d x t ⏟ = E x t ∼ q σ ( x t ∣ x 0 ) ( x t ) + A 2 ⋅ ∫ q σ ( x t ∣ x 0 ) ⋅ d x t ⏟ = 1 + σ t 2 − μ 2 = 1 − α t − 1 − σ t 2 1 − α t ⋅ ∫ x t 2 ⋅ q σ ( x t ∣ x 0 ) ⋅ d x t ⏟ = E x t ∼ q σ ( x t ∣ x 0 ) ( x t 2 ) = α t x 0 2 + ( 1 − α t ) + 2 ⋅ A ⋅ 1 − α t − 1 − σ t 2 1 − α t ⋅ ∫ x t ⋅ q σ ( x t ∣ x 0 ) ⋅ d x t ⏟ = E x t ∼ q σ ( x t ∣ x 0 ) ( x t ) = α t ⋅ x 0 + A 2 ⋅ ∫ q σ ( x t ∣ x 0 ) ⋅ d x t ⏟ = 1 + σ t 2 − μ 2 = 1 − α t − 1 − σ t 2 1 − α t ⋅ [ α t x 0 2 + ( 1 − α t ) ] + 2 ⋅ ( [ α t − 1 − α t ⋅ ( 1 − α t − 1 − σ t 2 ) 1 − α t ] ⋅ x 0 ) ⋅ 1 − α t − 1 − σ t 2 1 − α t ⋅ α t ⋅ x 0 + ( [ α t − 1 − α t ⋅ ( 1 − α t − 1 − σ t 2 ) 1 − α t ] ⋅ x 0 ) 2 + σ t 2 − μ 2 = 1 − α t − 1 − σ t 2 1 − α t ⋅ [ α t x 0 2 + ( 1 − α t ) ] + 2 ⋅ α t − 1 ⋅ x 0 2 α t ⋅ 1 − α t − 1 − σ t 2 1 − α t − 2 ⋅ α t ⋅ x 0 2 ⋅ ( 1 − α t − 1 − σ t 2 ) 1 − α t + x 0 2 ⋅ α t − 1 − 2 ⋅ x 0 2 ⋅ α t ⋅ α t − 1 ⋅ 1 − α t − 1 − σ t 2 1 − α t + x 0 2 ⋅ α t ⋅ ( 1 − α t − 1 − σ t 2 ) 1 − α t + σ t 2 − μ 2 = 1 − α t − 1 − σ t 2 1 − α t ⋅ [ α t x 0 2 + ( 1 − α t ) − 2 ⋅ α t ⋅ x 0 2 + α t ⋅ x 0 2 ] + 2 ⋅ α t − 1 ⋅ x 0 2 α t ⋅ 1 − α t − 1 − σ t 2 1 − α t + x 0 2 ⋅ α t − 1 − 2 ⋅ x 0 2 ⋅ α t ⋅ α t − 1 ⋅ 1 − α t − 1 − σ t 2 1 − α t + σ t 2 − μ 2 = 1 − α t − 1 − σ t 2 1 − α t ⋅ [ α t x 0 2 + ( 1 − α t ) − 2 ⋅ α t ⋅ x 0 2 + α t ⋅ x 0 2 ] + 2 ⋅ α t − 1 ⋅ x 0 2 α t ⋅ 1 − α t − 1 − σ t 2 1 − α t + x 0 2 ⋅ α t − 1 − 2 ⋅ x 0 2 ⋅ α t ⋅ α t − 1 ⋅ 1 − α t − 1 − σ t 2 1 − α t + σ t 2 − μ 2 = 1 − α t − 1 − σ t 2 1 − α t ⋅ ( 1 − α t ) + 2 ⋅ α t − 1 ⋅ x 0 2 α t ⋅ 1 − α t − 1 − σ t 2 1 − α t + x 0 2 ⋅ α t − 1 − 2 ⋅ x 0 2 ⋅ α t ⋅ α t − 1 ⋅ 1 − α t − 1 − σ t 2 1 − α t + σ t 2 − μ 2 ⏟ = α t − 1 ⋅ x 0 2 = 1 − α t − 1 − σ t 2 1 − α t ⋅ ( 1 − α t ) + 2 ⋅ α t − 1 ⋅ x 0 2 α t ⋅ 1 − α t − 1 − σ t 2 1 − α t − 2 ⋅ x 0 2 ⋅ α t ⋅ α t − 1 ⋅ 1 − α t − 1 − σ t 2 1 − α t + σ t 2 = 1 − α t − 1 − σ t 2 1 − α t ⋅ ( 1 − α t ) + σ t 2 = 1 − α t − 1 − σ t 2 + σ t 2 = 1 − α t − 1 \begin{equation} \begin{split} \sigma^2&=Var\big(q_{\sigma}(x_{t-1}|x_0)\big)\\ &=\int (x_{t-1}-\mu)^2\cdot q_{\sigma}(x_{t-1}|x_0)\cdot dx_{t-1} \\ &=\int (x_{t-1}^2-2\mu\cdot x_{t-1}+\mu^2)\cdot \Big(\int q_{\sigma}(x_t|x_0)\cdot q_{\sigma}(x_{t-1}|x_t,x_0) \cdot d{x_t} \Big)\cdot dx_{t-1} \\ &=\int \int (x_{t-1}^2-2\mu\cdot x_{t-1}+\mu^2)\cdot q_{\sigma}(x_t|x_0)\cdot q_{\sigma}(x_{t-1}|x_t,x_0) \cdot d{x_t} \cdot dx_{t-1} \\ &=\iint x_{t-1}^2\cdot q_{\sigma}(x_t|x_0)\cdot q_{\sigma}(x_{t-1}|x_t,x_0) \cdot d{x_t} \cdot dx_{t-1} -\iint 2\mu\cdot x_{t-1} \cdot q_{\sigma}(x_t|x_0)\cdot q_{\sigma}(x_{t-1}|x_t,x_0) \cdot d{x_t} \cdot dx_{t-1}+ \iint \mu^2 \cdot q_{\sigma}(x_t|x_0)\cdot q_{\sigma}(x_{t-1}|x_t,x_0) \cdot d{x_t} \cdot dx_{t-1} \\ &=\int \underbrace{\Bigg(\int x_{t-1}^2 \cdot q_{\sigma}(x_{t-1}|x_t,x_0) \cdot dx_{t-1} \Bigg)}_{=E(x_{t-1}^2)=\mu(x_t,x_0)^2+\sigma_t^2} \cdot q_{\sigma}(x_t|x_0)\cdot d{x_t} -2 \cdot \mu \int \underbrace{\Bigg(\int x_{t-1} \cdot q_{\sigma}(x_{t-1}|x_t,x_0) \cdot dx_{t-1} \Bigg)}_{=E(x_{t-1})=\mu(x_t,x_0)} \cdot q_{\sigma}(x_t|x_0)\cdot d{x_t} + \mu^2 \cdot \underbrace{\iint q_{\sigma}(x_t|x_0)\cdot q_{\sigma}(x_{t-1}|x_t,x_0) \cdot d{x_t} \cdot dx_{t-1}}_{=1} \\ &=\int \bigg(\mu(x_t,x_0)^2+\sigma_t^2\bigg) \cdot q_{\sigma}(x_t|x_0)\cdot d{x_t} -2 \cdot \mu \underbrace{ \int \mu(x_t,x_0) \cdot q_{\sigma}(x_t|x_0)\cdot d{x_t}}_{=\mu} + \mu^2 \\ &=\int \mu(x_t,x_0)^2 \cdot q_{\sigma}(x_t|x_0)\cdot d{x_t} + \sigma_t^2 \cdot \underbrace{ \int q_{\sigma}(x_t|x_0)\cdot d{x_t}}_{=1} -2 \cdot \mu ^2 + \mu^2\\ &=\int\Bigg(\sqrt{\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}}}\cdot x_t+ \underbrace{\bigg[\sqrt{\alpha_{t-1}}- \frac{\sqrt{ \alpha_t\cdot (1-\alpha_{t-1}-\sigma_t^2} )}{\sqrt{1-\alpha_t}} \bigg] \cdot x_0}_{为定值,设为A} \Bigg)^2 \cdot q_{\sigma}(x_t|x_0)\cdot d{x_t} + \sigma_t^2 - \mu ^2 \\ &=\int\Bigg(\sqrt{\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}}}\cdot x_t+ A \Bigg)^2 \cdot q_{\sigma}(x_t|x_0)\cdot d{x_t} + \sigma_t^2 - \mu ^2 \\ &=\int\Bigg(\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}}\cdot x_t^2+2\cdot A \cdot \sqrt{ \frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}}}\cdot x_t+ A^2 \Bigg)^2 \cdot q_{\sigma}(x_t|x_0)\cdot d{x_t} + \sigma_t^2 - \mu ^2 \\ &=\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}} \cdot \underbrace{\int x_t^2 \cdot q_{\sigma}(x_t|x_0)\cdot d{x_t}}_{=E_{x_t\sim q_{\sigma}(x_t|x_0)}(x_t^2)}+2\cdot A\cdot \sqrt {\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}} }\cdot \underbrace{\int x_t\cdot q_{\sigma}(x_t|x_0)\cdot d{x_t}}_{=E_{x_t\sim q_{\sigma}(x_t|x_0)}(x_t)}+A^2 \cdot \underbrace{ \int q_{\sigma}(x_t|x_0)\cdot d{x_t} }_{=1}+ \sigma_t^2 - \mu ^2 \\ &=\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}} \cdot \underbrace{\int x_t^2 \cdot q_{\sigma}(x_t|x_0)\cdot d{x_t}}_{=E_{x_t\sim q_{\sigma}(x_t|x_0)}(x_t^2)=\alpha_t x_0^2+(1-\alpha_t)}+2\cdot A\cdot \sqrt \frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}} \cdot \underbrace{\int x_t\cdot q_{\sigma}(x_t|x_0)\cdot d{x_t}}_{=E_{x_t\sim q_{\sigma}(x_t|x_0)}(x_t)=\sqrt{\alpha_t}\cdot x_0}+A^2 \cdot \underbrace{ \int q_{\sigma}(x_t|x_0)\cdot d{x_t} }_{=1}+ \sigma_t^2 - \mu ^2 \\ &=\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}} \cdot \bigg[\alpha_t x_0^2+(1-\alpha_t)\bigg]+2\cdot\Bigg(\bigg[\sqrt{\alpha_{t-1}}- \frac{\sqrt{ \alpha_t\cdot (1-\alpha_{t-1}-\sigma_t^2} )}{\sqrt{1-\alpha_t}} \bigg] \cdot x_0\Bigg) \cdot \sqrt \frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}} \cdot \sqrt{\alpha_t}\cdot x_0+\Bigg(\bigg[\sqrt{\alpha_{t-1}}- \frac{\sqrt{ \alpha_t\cdot (1-\alpha_{t-1}-\sigma_t^2} )}{\sqrt{1-\alpha_t}} \bigg] \cdot x_0\Bigg)^2 + \sigma_t^2 - \mu ^2 \\ &=\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}} \cdot \bigg[\alpha_t x_0^2+(1-\alpha_t)\bigg]+2\cdot \sqrt{\alpha_{t-1}}\cdot x_0^2 \sqrt{\alpha_t} \cdot \sqrt \frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}} - \frac{2\cdot \alpha_t \cdot x_0^2 \cdot (1-\alpha_{t-1}-\sigma_t^2)}{1-\alpha_t}+x_0^2\cdot \alpha_{t-1}-\frac{2\cdot x_0^2 \cdot \sqrt{\alpha_t}\cdot \sqrt{\alpha_{t-1}}\cdot \sqrt{1-\alpha_{t-1}-\sigma_t^2}}{\sqrt{1-\alpha_t}}+ \frac{x_0^2 \cdot \alpha_t \cdot (1-\alpha_{t-1}-\sigma_t^2)}{1-\alpha_t}+ \sigma_t^2 - \mu ^2\\ &=\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}} \cdot \bigg[\alpha_t x_0^2+(1-\alpha_t) -2 \cdot \alpha_t\cdot x_0^2 +\alpha_t \cdot x_0^2\bigg]+2\cdot \sqrt{\alpha_{t-1}}\cdot x_0^2 \sqrt{\alpha_t} \cdot \sqrt \frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}} +x_0^2\cdot \alpha_{t-1}-\frac{2\cdot x_0^2 \cdot \sqrt{\alpha_t}\cdot \sqrt{\alpha_{t-1}}\cdot \sqrt{1-\alpha_{t-1}-\sigma_t^2}}{\sqrt{1-\alpha_t}}+ \sigma_t^2 - \mu ^2\\ &=\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}} \cdot \bigg[\bcancel{\alpha_t x_0^2}+(1-\alpha_t) -\bcancel{2 \cdot \alpha_t\cdot x_0^2} +\bcancel{\alpha_t \cdot x_0^2}\bigg]+2\cdot \sqrt{\alpha_{t-1}}\cdot x_0^2 \sqrt{\alpha_t} \cdot \sqrt \frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}} +x_0^2\cdot \alpha_{t-1}-\frac{2\cdot x_0^2 \cdot \sqrt{\alpha_t}\cdot \sqrt{\alpha_{t-1}}\cdot \sqrt{1-\alpha_{t-1}-\sigma_t^2}}{\sqrt{1-\alpha_t}}+ \sigma_t^2 - \mu ^2\\ &=\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}} \cdot (1-\alpha_t)+2\cdot \sqrt{\alpha_{t-1}}\cdot x_0^2 \sqrt{\alpha_t} \cdot \sqrt \frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}} +\bcancel{x_0^2\cdot \alpha_{t-1}}-\frac{2\cdot x_0^2 \cdot \sqrt{\alpha_t}\cdot \sqrt{\alpha_{t-1}}\cdot \sqrt{1-\alpha_{t-1}-\sigma_t^2}}{\sqrt{1-\alpha_t}}+ \sigma_t^2 - \underbrace{ \bcancel{\mu ^2}}_{=\alpha_{t-1}\cdot x_0^2}\\ &=\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}} \cdot (1-\alpha_t)+\bcancel {2\cdot \sqrt{\alpha_{t-1}}\cdot x_0^2 \sqrt{\alpha_t} \cdot \sqrt \frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}}} -\bcancel{\frac{2\cdot x_0^2 \cdot \sqrt{\alpha_t}\cdot \sqrt{\alpha_{t-1}}\cdot \sqrt{1-\alpha_{t-1}-\sigma_t^2}}{\sqrt{1-\alpha_t}} }+ \sigma_t^2 \\ &=\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}} \cdot (1-\alpha_t)+ \sigma_t^2 \\ &=1-\alpha_{t-1}-\sigma_t^2 + \sigma_t^2 \\ &=1-\alpha_{t-1} \end{split} \end{equation} σ2=Var(qσ(xt1x0))=(xt1μ)2qσ(xt1x0)dxt1=(xt122μxt1+μ2)(qσ(xtx0)qσ(xt1xt,x0)dxt)dxt1=∫∫(xt122μxt1+μ2)qσ(xtx0)qσ(xt1xt,x0)dxtdxt1=xt12qσ(xtx0)qσ(xt1xt,x0)dxtdxt12μxt1qσ(xtx0)qσ(xt1xt,x0)dxtdxt1+μ2qσ(xtx0)qσ(xt1xt,x0)dxtdxt1==E(xt12)=μ(xt,x0)2+σt2 (xt12qσ(xt1xt,x0)dxt1)qσ(xtx0)dxt2μ=E(xt1)=μ(xt,x0) (xt1qσ(xt1xt,x0)dxt1)qσ(xtx0)dxt+μ2=1 qσ(xtx0)qσ(xt1xt,x0)dxtdxt1=(μ(xt,x0)2+σt2)qσ(xtx0)dxt2μ=μ μ(xt,x0)qσ(xtx0)dxt+μ2=μ(xt,x0)2qσ(xtx0)dxt+σt2=1 qσ(xtx0)dxt2μ2+μ2=(1αt1αt1σt2 xt+为定值,设为A [αt1 1αt αt(1αt1σt2 )]x0)2qσ(xtx0)dxt+σt2μ2=(1αt1αt1σt2 xt+A)2qσ(xtx0)dxt+σt2μ2=(1αt1αt1σt2xt2+2A1αt1αt1σt2 xt+A2)2qσ(xtx0)dxt+σt2μ2=1αt1αt1σt2=Extqσ(xtx0)(xt2) xt2qσ(xtx0)dxt+2A1αt1αt1σt2 =Extqσ(xtx0)(xt) xtqσ(xtx0)dxt+A2=1 qσ(xtx0)dxt+σt2μ2=1αt1αt1σt2=Extqσ(xtx0)(xt2)=αtx02+(1αt) xt2qσ(xtx0)dxt+2A1αt1αt1σt2 =Extqσ(xtx0)(xt)=αt x0 xtqσ(xtx0)dxt+A2=1 qσ(xtx0)dxt+σt2μ2=1αt1αt1σt2[αtx02+(1αt)]+2([αt1 1αt αt(1αt1σt2 )]x0)1αt1αt1σt2 αt x0+([αt1 1αt αt(1αt1σt2 )]x0)2+σt2μ2=1αt1αt1σt2[αtx02+(1αt)]+2αt1 x02αt 1αt1αt1σt2 1αt2αtx02(1αt1σt2)+x02αt11αt 2x02αt αt1 1αt1σt2 +1αtx02αt(1αt1σt2)+σt2μ2=1αt1αt1σt2[αtx02+(1αt)2αtx02+αtx02]+2αt1 x02αt 1αt1αt1σt2 +x02αt11αt 2x02αt αt1 1αt1σt2 +σt2μ2=1αt1αt1σt2[αtx02 +(1αt)2αtx02 +αtx02 ]+2αt1 x02αt 1αt1αt1σt2 +x02αt11αt 2x02αt αt1 1αt1σt2 +σt2μ2=1αt1αt1σt2(1αt)+2αt1 x02αt 1αt1αt1σt2 +x02αt1 1αt 2x02αt αt1 1αt1σt2 +σt2=αt1x02 μ2 =1αt1αt1σt2(1αt)+2αt1 x02αt 1αt1αt1σt2 1αt 2x02αt αt1 1αt1σt2 +σt2=1αt1αt1σt2(1αt)+σt2=1αt1σt2+σt2=1αt1
    由公式(5)和公式(6)可以得出公式(7)所示结论,Lemma 1得到证明。
    q σ ( x t − 1 ∣ x 0 ) = N ( x t − 1 ; α t − 1 ⋅ x 0 , ( 1 − α t − 1 ) I ) \begin{equation} \begin{split} q_{\sigma}(x_{t-1}|x_0)=N(x_{t-1};\sqrt{\alpha_{t-1}}\cdot x_0,(1-\alpha_{t-1})I) \end{split} \end{equation} qσ(xt1x0)=N(xt1;αt1 x0,(1αt1)I)
    方法2:
    这个证明过程就是论文中的证明过程 ,该过程引用了 《Pattern Recognition and Machine Learning》一书中93页的公式(2.113)、(2.114)、(2.115),公式内容如下图所示。
    在这里插入图片描述
    q σ ( x t ∣ x 0 ) = N ( x t ; α t ⋅ x 0 , ( 1 − α t ) I ) ⇕ p ( x ) = N ( x ∣ μ , Λ − 1 ) ( 2.113 ) q σ ( x t − 1 ∣ x t , x 0 ) = N ( x t − 1 ; 1 − α t − 1 − σ t 2 1 − α t ⋅ x t + [ α t − 1 − α t ⋅ ( 1 − α t − 1 − σ t 2 ) 1 − α t ] ⋅ x 0 , σ t 2 I ) ⇕ p ( y ∣ x ) = N ( y ∣ A x + b , L − 1 ) ( 2.114 ) q σ ( x t − 1 ∣ x 0 ) ⇔ p ( y ) = N ( y ∣ A μ + b , L − 1 + A Λ − 1 A T ) \begin{equation} \begin{split} q_{\sigma}(x_{t}|x_0)&=N(x_{t};\sqrt{\alpha_{t}}\cdot x_0,(1-\alpha_{t})I)\\ &\Updownarrow\\ p(x)&=N(x|\mu,\Lambda^{-1}) (2.113)\\ q_{\sigma}(x_{t-1}|x_t,x_0)&=N\Bigg(x_{t-1};\sqrt{\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}}}\cdot x_t+ \bigg[\sqrt{\alpha_{t-1}}- \frac{\sqrt{ \alpha_t\cdot (1-\alpha_{t-1}-\sigma_t^2} )}{\sqrt{1-\alpha_t}} \bigg] \cdot x_0 ,\sigma_t^2 I\Bigg) \\ &\Updownarrow\\ p(y|x)&=N(y|Ax+b,L^{-1})(2.114)\\ q_\sigma(x_{t-1}|x_0)& \Leftrightarrow p(y)=N(y|A\mu+b,L^{-1}+A\Lambda^{-1}A^T) \end{split} \end{equation} qσ(xtx0)p(x)qσ(xt1xt,x0)p(yx)qσ(xt1x0)=N(xt;αt x0,(1αt)I)=N(xμ,Λ1)(2.113)=N(xt1;1αt1αt1σt2 xt+[αt1 1αt αt(1αt1σt2 )]x0,σt2I)=N(yAx+b,L1)(2.114)p(y)=N(yAμ+b,L1+AΛ1AT)
    对比可以知道,(2.113)和(2.114)中的各项分别如下所示
    μ = α t ⋅ x 0 Λ − 1 = 1 − α t A = 1 − α t − 1 − σ t 2 1 − α t b = [ α t − 1 − α t ⋅ ( 1 − α t − 1 − σ t 2 ) 1 − α t ] ⋅ x 0 L − 1 = σ t 2 \begin{equation} \begin{split} \mu&=\sqrt{\alpha_{t}}\cdot x_0\\ \Lambda^{-1}&=1-\alpha_{t}\\ A&=\sqrt{\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}}}\\ b&=\bigg[\sqrt{\alpha_{t-1}}- \frac{\sqrt{ \alpha_t\cdot (1-\alpha_{t-1}-\sigma_t^2} )}{\sqrt{1-\alpha_t}} \bigg] \cdot x_0 \\ L^{-1}&=\sigma_t^2 \end{split} \end{equation} μΛ1AbL1=αt x0=1αt=1αt1αt1σt2 =[αt1 1αt αt(1αt1σt2 )]x0=σt2
    分布 q σ ( x t − 1 ∣ x 0 ) q_\sigma(x_{t-1}|x_0) qσ(xt1x0)的均值和方差分别如下所示:
    E ( q σ ( x t − 1 ∣ x 0 ) ) = E ( p ( y ) ) = A μ + b = 1 − α t − 1 − σ t 2 1 − α t ⋅ α t ⋅ x 0 + [ α t − 1 − α t ⋅ ( 1 − α t − 1 − σ t 2 ) 1 − α t ] ⋅ x 0 = 1 − α t − 1 − σ t 2 1 − α t ⋅ α t ⋅ x 0 + α t − 1 ⋅ x 0 − α t ⋅ ( 1 − α t − 1 − σ t 2 ) 1 − α t ⋅ x 0 = α t − 1 ⋅ x 0 V a r ( q σ ( x t − 1 ∣ x 0 ) ) = V a r ( p ( y ) ) = L − 1 + A Λ − 1 A T = σ t 2 + 1 − α t − 1 − σ t 2 1 − α t ⋅ ( 1 − α t ) ⋅ 1 − α t − 1 − σ t 2 1 − α t = σ t 2 + 1 − α t − 1 − σ t 2 = 1 − α t − 1 \begin{equation} \begin{split} E\big(q_\sigma(x_{t-1}|x_0)\big)&=E\big(p(y)\big)\\ &=A\mu+b\\ &=\sqrt{\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}}}\cdot \sqrt{\alpha_{t}}\cdot x_0+\bigg[\sqrt{\alpha_{t-1}}- \frac{\sqrt{ \alpha_t\cdot (1-\alpha_{t-1}-\sigma_t^2} )}{\sqrt{1-\alpha_t}} \bigg] \cdot x_0 \\ &=\bcancel{\sqrt{\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}}}\cdot \sqrt{\alpha_{t}}\cdot x_0}+\sqrt{\alpha_{t-1}}\cdot x_0-\bcancel{\frac{\sqrt{ \alpha_t\cdot (1-\alpha_{t-1}-\sigma_t^2} )}{\sqrt{1-\alpha_t}} \cdot x_0}\\ &=\sqrt{\alpha_{t-1}}\cdot x_0 \\ \\ \\ Var\big(q_\sigma(x_{t-1}|x_0)\big)&=Var\big(p(y)\big)\\ &=L^{-1}+A\Lambda^{-1}A^T \\ &=\sigma_t^2+\sqrt{\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}}}\cdot (1-\alpha_{t}) \cdot \sqrt{\frac{1-\alpha_{t-1}-\sigma_t^2}{1-\alpha_{t}}} \\ &=\sigma_t^2+1-\alpha_{t-1}-\sigma_t^2\\ &=1-\alpha_{t-1} \end{split} \end{equation} E(qσ(xt1x0))Var(qσ(xt1x0))=E(p(y))=Aμ+b=1αt1αt1σt2 αt x0+[αt1 1αt αt(1αt1σt2 )]x0=1αt1αt1σt2 αt x0 +αt1 x01αt αt(1αt1σt2 )x0 =αt1 x0=Var(p(y))=L1+AΛ1AT=σt2+1αt1αt1σt2 (1αt)1αt1αt1σt2 =σt2+1αt1σt2=1αt1
    证毕!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/76360.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

人工智能在医疗领域的前沿应用与挑战

在当今数字化时代,人工智能(AI)技术正以前所未有的速度改变着我们的生活,其中医疗领域无疑是受益最为显著的行业之一。从疾病诊断、治疗方案制定到患者护理,AI的应用不仅提高了医疗服务的效率和质量,还为医…

【计算机网络】HTTP与HTTPS

文章目录 1. HTTP定义2. HTTP交互3. HTTP报文格式3.1 抓包工具-fiddler3.2 抓包操作3.3 报文格式3.3.1 请求报文3.3.2 响应报文 4. URL5. 请求头中的方法6. GET和POST的区别7. HTTP报头7.1 Host7.2 Content_Length7.3 Content_Type7.4 User-Agent(UA)7.5 Referer7.6 Cookie 8 状…

怎样提升大语言模型(LLM)回答准确率

怎样提升大语言模型(LLM)回答准确率 目录 怎样提升大语言模型(LLM)回答准确率激励与规范类知识关联类情感与语境类逆向思维类:为什么不,反面案例群体智慧类明确指令类示例引导类思维引导类约束限制类反馈交互类:对话激励与规范类 给予奖励暗示:在提示词中暗示模型如果回…

【分享】内外网文件摆渡系统:让数据传输更安全更可靠

【分享】Ftrans内外网文件摆渡系统:让数据传输更安全更可靠! 随着大数据时代的到来,数据的重要性日渐得到重视,数据作为数字经济时代下的基础性资源和战略性资源,是决定国家经济发展水平和竞争力的核心驱动力。以行业…

Python自动化面试通关秘籍

Python自动化测试工程师面试,不仅仅是考察你的代码能力,更看重你如何在项目中灵活运用工具和框架解决实际问题。如果你正准备面试,这篇文章将为你总结最常见的高频考题及答题技巧,帮助你快速上手,通关面试,…

Logstash开启定时任务增量同步mysql数据到es的时区问题

本文使用修改时间modify_date作为增量同步检测字段,可检测新增和修改,检测不到删除,检测删除请使用canal查询binlog日志同步数据 检测修改时间字段为varchar的时候可以先创建索引,并设置对应的mapping为(可以无视时区…

如何使用 FastAPI 构建 MCP 服务器

哎呀,各位算法界的小伙伴们!今天咱们要聊聊一个超酷的话题——MCP 协议!你可能已经听说了,Anthropic 推出了这个新玩意儿,目的是让 AI 代理和你的应用程序之间的对话变得更顺畅、更清晰。不过别担心,为你的…

【Git】-- 处理 Git 提交到错误分支的问题

如果你不小心把本应提交到 test 分支的代码提交到了 master 分支(但尚未 push),可以按照以下步骤解决: 方法一(推荐):使用 git reset 和 git stash 首先,确保你在 master 分支&…

通用目标检测技术选型分析报告--截止2025年4月

前言 本文撰写了一份关于通用目标检测(General Object Detection)的技术选型分析报告,覆盖2000至2025年技术演进历程,重点纳入YOLO-World、RT-DETR、Grounding DINO等2024-2025年的最新模型。 报告将包括技术定义、行业现状、技…

链路追踪Skywalking

一、什么是Skywalking 分布式链路追踪的一种方式:Spring Cloud SleuthZipKin,这种方案目前也是有很多企业在用,但是作为程序员要的追逐一些新奇的技术,Skywalking作为后起之秀也是值得大家去学习的。 Skywalking是一个优秀的国产…

websocket获取客服端真实ip

在websocket建立连接时,获取访问客户端的真实ip 1. websocket建立连接过程 2. pom依赖 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-websocket</artifactId></dependency>3. 添加配置,握…

NSSCTF(MISC)—[justCTF 2020]pdf

相应的做题地址&#xff1a;https://www.nssctf.cn/problem/920 binwalk分离 解压文件2AE59A.zip mutool 得到一张图片 B5F31内容 B5FFD内容 转换成图片 justCTF{BytesAreNotRealWakeUpSheeple}

部分国产服务器CPU及内存性能测试情况

近日对部分国产服务器进行了CPU和内存的性能测试&#xff0c; 服务器包括华锟振宇、新华三和中兴三家&#xff0c;CPU包括鲲鹏、海光和Intel&#xff0c;初步测试结果如下&#xff1a; 服务器厂商四川华锟振宇新华三中兴中兴服务器HuaKun TG225 B1R4930 G5R5930 G2R5300 G4操作…

【无标题】Scala函数基础

函数和方法的区别 1&#xff09; 核心概念 &#xff08;1&#xff09; 为完成某一功能的程序语句的集合&#xff0c;称为函数。 &#xff08;2&#xff09; 类中的函数称之方法。 2&#xff09; 案例实操 &#xff08;1&#xff09; Scala 语言可以在任何的语法结构中声明…

uniapp -- 列表垂直方向拖拽drag组件

背景 需要在小程序中实现拖拽排序功能,所以就用到了m-drag拖拽组件,在开发的过程中,发现该组件在特殊的场景下会有些问题,并对其进行了拓展。 效果 组件代码 <template><!-- 创建一个垂直滚动视图,类名为m-drag --><scroll

conda安装python 遇到 pip is configured with locations that require TLS/SSL问题本质解决方案

以前写了一篇文章&#xff0c;不过不是专门为了解决这个问题的&#xff0c;但是不能访问pip install 不能安装来自https 协议的包问题几乎每次都出现&#xff0c;之前解决方案只是治标不治本 https://blog.csdn.net/wangsenling/article/details/130194456​​​​​​​https…

【初阶数据结构】队列

文章目录 目录 一、概念与结构 二、队列的实现 队列的定义 1.初始化 2.入队列 3.判断队列是否为空 4.出队列 5.取队头数据 6.取队尾数据 7.队列有效个数 8.销毁队列 三.完整源码 总结 一、概念与结构 概念&#xff1a;只允许在一端进行插入数据操作&#xff0c;在另一端进行删除…

Apache Shiro 全面指南:从入门到高级应用

一、Shiro 概述与核心架构 1.1 什么是 Shiro&#xff1f; Apache Shiro 是一个强大且易用的 Java 安全框架&#xff0c;它提供了认证&#xff08;Authentication&#xff09;、授权&#xff08;Authorization&#xff09;、加密&#xff08;Cryptography&#xff09;和会话管…

es 3期 第28节-深入掌握集群组建与集群设置

#### 1.Elasticsearch是数据库&#xff0c;不是普通的Java应用程序&#xff0c;传统数据库需要的硬件资源同样需要&#xff0c;提升性能最有效的就是升级硬件。 #### 2.Elasticsearch是文档型数据库&#xff0c;不是关系型数据库&#xff0c;不具备严格的ACID事务特性&#xff…

Android学习总结之通信篇

一、Binder跨进程通信的底层实现细节&#xff08;挂科率35%&#xff09; 高频问题&#xff1a;“Binder如何实现一次跨进程方法调用&#xff1f;”   候选人常见错误&#xff1a;   仅回答“通过Binder驱动传输数据”&#xff0c;缺乏对内存映射和线程调度的描述混淆Binde…