Commit b3ffcd6e by xiaotong

new update

parent ca239bf0
...@@ -20,6 +20,9 @@ ...@@ -20,6 +20,9 @@
\usepackage{subfigure} \usepackage{subfigure}
\usepackage{tikz-3dplot} \usepackage{tikz-3dplot}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\usetikzlibrary{matrix} \usetikzlibrary{matrix}
\usetikzlibrary{arrows,decorations.pathreplacing} \usetikzlibrary{arrows,decorations.pathreplacing}
\usetikzlibrary{shadows} % LATEX and plain TEX when using Tik Z \usetikzlibrary{shadows} % LATEX and plain TEX when using Tik Z
...@@ -111,70 +114,34 @@ ...@@ -111,70 +114,34 @@
\newcounter{mycount3} \newcounter{mycount3}
\newcounter{mycount4} \newcounter{mycount4}
%%%------------------------------------------------------------------------------------------------------------ %%%------------------------------------------------------------------------------------------------------------
%%% 张量的单元操作 %%% 定义XTensor
\begin{frame}{张量的单元操作} \begin{frame}{定义XTensor}
\begin{itemize} \begin{itemize}
\item 神经网络$\textbf{y}=f(\textbf{x}\cdot \textbf{w} + \textbf{b})$也包括一些张量的单元操作(element-wise opertation) \item NiuTensor张量由类XTensor定义
\begin{itemize} \begin{itemize}
\item 加法:$\textbf{s}+\textbf{b}$,其中$\textbf{s} = \textbf{x}\cdot \textbf{w}$ \item \textbf{必须指定}:张量的阶和各个方向维度的大小,关于维度的约定和传统多维数组一样
\item 激活函数:$f(\cdot)$ \item \textbf{可以指定}:张量数据类型、稠密程度等等
\end{itemize} \end{itemize}
\item<2-> \textbf{单元加}就是对张量中的每个位置都进行加法
\begin{itemize}
\item 一般要求两个张量的形状是一样的
\item<3-> 不过,这里可以使用加法的\textbf{广播},重复利用一个张量进行加法,并不要求两个张量形状相同
\end{itemize}
\end{itemize} \end{itemize}
\vspace{-1.5em} \begin{tcolorbox}[enhanced,frame engine=empty,boxrule=0.1mm,size=title,colback=blue!10!white]
\begin{center} \begin{flushleft}
\begin{tikzpicture} {\scriptsize
\visible<3->{ \begin{tabbing}
\begin{scope}
\setcounter{mycount1}{1}
\draw[step=0.5cm,color=orange,thick] (-1,-0.5) grid (1,0.5);
\foreach \y in {+0.25,-0.25}
\foreach \x in {-0.75,-0.25,0.25,0.75}{
\node [fill=orange!20,inner sep=0pt,minimum height=0.49cm,minimum width=0.49cm] at (\x,\y) {\number\value{mycount1}};
\addtocounter{mycount1}{1};
}
\node [anchor=south] (varlabel) at (0,0.6) {$\textbf{s}$};
\end{scope}
\begin{scope}[xshift=1.5in]
\setcounter{mycount1}{1}
\draw[step=0.5cm,color=ugreen,thick] (-1,-0) grid (1,0.5);
\foreach \y in {+0.25}
\foreach \x in {-0.75,-0.25,0.25,0.75}{
\node [fill=green!20,inner sep=0pt,minimum height=0.49cm,minimum width=0.49cm] at (\x,\y) {1};
\addtocounter{mycount1}{1};
}
\node [anchor=center] (plabel) at (-4.5em,0) {\huge{\textbf{$+$}}};
\node [anchor=south] (varlabel) at (0,0.6) {$\textbf{b}$};
\end{scope}
\begin{scope}[xshift=3in]
\setcounter{mycount1}{2}
\draw[step=0.5cm,color=orange,thick] (-1,-0.5) grid (1,0.5);
\foreach \y in {+0.25,-0.25}
\foreach \x in {-0.75,-0.25,0.25,0.75}{
\node [fill=orange!20,inner sep=0pt,minimum height=0.49cm,minimum width=0.49cm] at (\x,\y) {\number\value{mycount1}};
\addtocounter{mycount1}{1};
}
\node [anchor=center] (plabel) at (-4.5em,0) {\huge{\textbf{$=$}}};
\node [anchor=south] (varlabel) at (0,0.6) {$\textbf{s+b}$};
\end{scope}
}
\end{tikzpicture} \texttt{XTensor tensor;} \hspace{12em} \= // 声明张量tensor \\
\end{center} \texttt{int sizes[3] = \{2,3,4\};} \> // 张量的形状为2*3*4 \\
\begin{itemize} \texttt{InitTensor(\&tensor, 3, sizes, X\_FLOAT);} \> // 定义形状为sizes的三阶张量
\item<4-> 类似的,我们可以对所有位置做加法、乘法等等一系列算数操作,也包括激活函数 \end{tabbing}
\end{itemize} }
\end{flushleft}
\end{tcolorbox}
\end{frame} \end{frame}
%%%------------------------------------------------------------------------------------------------------------ %%%------------------------------------------------------------------------------------------------------------
\subsection{参数学习 - 反向传播} \subsection{参数学习 - 反向传播}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论