latex 算法伪代码右三角注释 |
您所在的位置:网站首页 › 伪代码怎么写 › latex 算法伪代码右三角注释 |
在写论文的时候经常要用到伪代码,有时候要对一些算法进行注释更加美观,例如: 对算法加了注释能够使审稿人更明白你的算法内容,那这样的注释应该怎么加? 其实就是一个\Comment{} 命令,在开始之前需要导入算法包,这儿就不提示了,我就直接放核心代码 \begin{algorithm}[htb] \caption{ Sparse-attention for Each Window} % \label{alg:Framwork} \begin{algorithmic}[1] \Require Labeled samples ($X$, $Y$) and unlabeled sample $(\bar{X}, \bar{Y})$. \State self-attention feature map S; \State randomly select U dot-product pairs from K as $\bar{K}$; \textcolor{blue}{\Comment{this is a comment}} \State set the sample score $\bar{S}=Q\bar{K}$; \State compute the similarity $M = $Max($\bar{S})$ - Mean($\bar{S}$) by rows; \State set top-$u$ queries under $M$ as $\bar{Q}$; \State set $ S $ = \{ softmax($\bar{Q}K^{T}/\sqrt{d}$)$\cdot V$, Mean($V$) \} by rows; \end{algorithmic} \end{algorithm}展示的结果图:
|
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |