%% 
%%  An UIT Edition example
%% 
%%  Example 04-27-26 on page 146.
%% 
%%  Copyright (C) 2012 Vo\ss 
%% 
%%  It may be distributed and/or modified under the conditions
%%  of the LaTeX Project Public License, either version 1.3
%%  of this license or (at your option) any later version.
%% 
%%  See http://www.latex-project.org/lppl.txt for details.
%% 

% Show page(s) 1,2,3

%% ==== 
\PassOptionsToClass{}{beamer}
\documentclass[serif,aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{ragged2e}
\usepackage{colortbl}
\usepackage{rotating}
%\StartShownPreambleCommands
\usepackage{amsmath,esint}
\usepackage[british]{babel}
\usetheme{Warsaw}
\usecolortheme{rose}
\usepackage{amsfonts,amssymb}
\usepackage{physics}
%\usetheme{metropolis}
%\usepackage{appendixnumberbeamer}

%\StopShownPreambleCommands
\usepackage{pgfplots}
\usepackage{mathrsfs}
\usepackage{xcolor}
\usepackage{ulem}
\usepackage{gensymb}
\usepackage{color}
\usetikzlibrary{shapes,backgrounds,calc,positioning,fadings,arrows,automata}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{tkz-fct}  
\usetikzlibrary{calc}

\usepackage{stackengine}

\usepackage[ruled]{algorithm2e}
\usepackage{tikz}
\usepackage{animate}
\usepackage{ragged2e}
\usepackage{bbm}
\usepackage{soul,color}
\newcommand{\highlight}[1]{%
  \colorbox{red!50}{$\displaystyle#1$}}

\DeclareMathOperator*{\minimize}{minimize}

\addtobeamertemplate{navigation symbols}{}{%
    \usebeamerfont{footline}%
    \usebeamercolor[fg]{footline}%
    \hspace{1em}%
    \insertframenumber/\inserttotalframenumber
}

\newcommand{\borderColor}{white}
\newcommand{\forefillColor}{blue!20!black!30!green}
\newcommand{\toprsidefillcolor}{green!40}


\newcommand{\fakealign}{%
   \mbox{\hspace{5cm}} & \mbox{\hspace{5cm}} \nonumber\\%
}
\renewcommand{\thealgocf}{}
\makeatletter
\newcommand\titlegraphicii[1]{\def\inserttitlegraphicii{#1}}
\titlegraphicii{}
\setbeamertemplate{title page}
{
 \vspace{0.3in}
 \vbox{}
  %{\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic\hfill\inserttitlegraphicii\par}
 \begin{centering}
   \begin{beamercolorbox}[sep=8pt,center]{title}
     \usebeamerfont{title}\inserttitle\par%
     \ifx\insertsubtitle\@empty%
     \else%
       \vskip0.25em%
       {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
     \fi%    
   \end{beamercolorbox}%
   \vskip1em\par
   \begin{beamercolorbox}[sep=8pt,center]{date}
     \usebeamerfont{date}\insertdate
   \end{beamercolorbox}%\vskip0.5em
   \begin{beamercolorbox}[sep=8pt,center]{author}
     \usebeamerfont{author}\insertauthor
   \end{beamercolorbox}
   \begin{beamercolorbox}[sep=8pt,center]{institute}
     \usebeamerfont{institute}\insertinstitute
   \end{beamercolorbox}
 \end{centering}
 %\vfill
}
\makeatother
%\author{Anirban Laha and Preksha Nema \\\vspace{0.2in} Presented By: Mitesh M. Khapra}
\author{Mitesh M. Khapra}
\title{CS7015 (Deep Learning) : Lecture 15}
\subtitle{Gated Recurrent Units, Long Short Term Memory Cells}
\institute{Department of Computer Science and Engineering\\ Indian Institute of Technology Madras}
\date{March 19, 2017}
\titlegraphic{\includegraphics[height=1cm,width=2cm]{images/iitm_logo.png}}

%\addtobeamertemplate{navigation symbols}{}{%
%    \usebeamerfont{footline}%
%    \usebeamercolor[fg]{footline}%
%    \hspace{1em}%
%    \insertframenumber/\inserttotalframenumber
%}

\usetikzlibrary{svg.path}
\usetikzlibrary{decorations.pathreplacing,decorations.markings}
\newcounter{pos}
\tikzset{
  initcounter/.code={\setcounter{pos}{0}},
  style between/.style n args={3}{
    postaction={
      initcounter,
      decorate,
      decoration={
        show path construction,
        curveto code={
          \addtocounter{pos}{1}
          \pgfmathtruncatemacro{\min}{#1 - 1}
          \ifthenelse{\thepos < #2 \AND \thepos > \min}{
            \draw[#3]
            (\tikzinputsegmentfirst)
            ..
            controls (\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb)
            ..
            (\tikzinputsegmentlast);
          }{}
        }
      }
    },
  },
}

\newcommand{\handmadecube}[5]{
  
  \pgfmathsetmacro{\width}{#1}
  \pgfmathsetmacro{\height}{#2}
  \pgfmathsetmacro{\ti}{#3}
  \pgfmathsetmacro{\x}{#4}
  \pgfmathsetmacro{\y}{#5}
  
  
  \pgfmathsetmacro{\yfactor}{0.9}
  \pgfmathsetmacro{\xfactor}{0.6}
  
  
  % % square
  \draw [-,draw=\borderColor] (\x-\width,\y) -- (\x,\y); % % x cahnge ->
  \draw [-,draw=\borderColor] (\x,\y) -- (\x,\y-\height); % % y change   |
  \draw [-,draw=\borderColor] (\x,\y-\height) -- (\x-\width,\y-\height); % % x change <-
  \draw [-,draw=\borderColor] (\x-\width,\y-\height) -- (\x-\width,\y); % % y change  |
  
  \draw  [draw=\borderColor,fill=\forefillColor] (\x-\width,\y)--(\x,\y) -- (\x,\y-\height) -- (\x-\width,\y-\height) --cycle ;
  
  \draw  [draw=\borderColor,fill=\toprsidefillcolor] (\x,\y) -- (\x+\xfactor*\ti,\y+\yfactor*\ti) -- (\x+\xfactor*\ti,\y+\yfactor*\ti-\height) -- (\x,\y-\height) --cycle ;
  
  \draw  [draw=\borderColor,fill=\toprsidefillcolor] (\x-\width,\y)--(\x,\y) -- (\x+\xfactor*\ti,\y+\yfactor*\ti) -- (\x+\xfactor*\ti-\width,\y+\yfactor*\ti) --cycle ;
  
  \draw [-,draw=\borderColor]   (\x,\y) -- (\x+\xfactor*\ti,\y+\yfactor*\ti);
  
  \draw [-,draw=\borderColor] (\x-\width,\y) -- (\x-\width+\xfactor*\ti,\y+\yfactor*\ti);
  
  \draw [-,draw=\borderColor] (\x-\width+\xfactor*\ti,\y+\yfactor*\ti) -- (\x+\xfactor*\ti,\y+\yfactor*\ti);
  
  \draw [-,draw=\borderColor] (\x+\xfactor*\ti,\y+\yfactor*\ti) -- (\x+\xfactor*\ti,\y+\yfactor*\ti-\height);
  
  \draw [-,draw=\borderColor] (\x,\y-\height) -- (\x+\xfactor*\ti,\y+\yfactor*\ti-\height);
  
}

\def\cuboid#1#2#3#4#5{
  \begin{scope}
    \edef\mycolor{#2}
    \edef\depth{#3}
    \edef\height{#4}
    \edef\width{#5}
    \draw[black,fill=\mycolor] #1 -- ++(-\depth,0,0) -- ++(0,-\height,0) -- ++(\depth,0,0) -- cycle #1 -- ++(0,0,-\width) -- ++(0,-\height,0) -- ++(0,0,\width) -- cycle  #1 -- ++(-\depth,0,0) -- ++(0,0,-\width) -- ++(\depth,0,0) -- cycle;
  \end{scope}
}


\def\cuboidlabelmine#1#2#3#4#5#6#7#8{
  \begin{scope}
    \edef\mycolor{#2}
    \edef\depth{#3}
    \edef\height{#4}
    \edef\width{#5}
    \edef\depthlabel{#6}
    \edef\heightlabel{#7}
    \edef\widthlabel{#8}
    \draw[black,fill=\mycolor] #1 -- ++(-\depth,0,0) -- ++(0,-\height,0) -- ++(\depth,0,0) node[pos=0.5,below] {\tiny \depthlabel} -- cycle #1 -- ++(0,0,-\width) -- ++(0,-\height,0) node[pos=0.5,right,outer sep=-3pt] {\tiny \heightlabel} -- ++(0,0,\width)  node[pos=0.5,below] {\tiny \widthlabel} -- cycle  #1 -- ++(-\depth,0,0) -- ++(0,0,-\width) -- ++(\depth,0,0) -- cycle;
  \end{scope}
}



\def\lenetparamnew#1#2#3#4#5#6#7#8{
  \begin{scope}
    \edef\mycolor{#2}
    \edef\depth{#3}
    \edef\height{#4}
    \edef\width{#5}
    \edef\depthlabel{#8}
    \edef\heightlabel{#7}
    \edef\sep{#6}
    \draw[black,fill=\mycolor] #1 -- ++(-\depth,0,0) -- ++(0,-\height,0) -- ++(\depth,0,0) -- cycle #1 -- ++(0,0,-\width) -- ++(0,-\height,0) node[pos=0.9,above,outer sep=-13 pt] {\tiny \heightlabel} node[pos=0.9,above,outer sep=-20 pt] {\tiny \depthlabel} -- ++(0,0,\width)  -- cycle  #1 -- ++(-\depth,0,0) -- ++(0,0,-\width) -- ++(\depth,0,0) -- cycle;
  \end{scope}
}

\def\lenetparam#1#2#3#4#5#6#7#8{
  \begin{scope}
    \edef\mycolor{#2}
    \edef\depth{#3}
    \edef\height{#4}
    \edef\width{#5}
    \edef\depthlabel{#6}
    \edef\heightlabel{#7}
    \edef\widthlabel{#8}
    \draw[black] #1 -- ++(-\depth,0,0) -- ++(0,-\height,0) -- ++(\depth,0,0) node[pos=0.5,above,outer sep=-28pt] {\tiny \depthlabel} node[pos=0.6,above,outer sep=-35pt] {\tiny \heightlabel} node[pos=0.5,above,outer sep=-42] {\tiny \widthlabel}  -- cycle #1 -- ++(0,0,-\width) -- ++(0,-\height,0)  -- ++(0,0,\width) -- cycle  #1 -- ++(-\depth,0,0) -- ++(0,0,-\width) -- ++(\depth,0,0) -- cycle;
  \end{scope}
}

\def\kernel#1#2#3#4#5#6{
  \begin{scope}
    \edef\mycolor{#2}
    \edef\depth{#3}
    \edef\height{#4}
    \edef\width{#5}
    \draw[black,fill=\mycolor] #1 -- ++(-\depth,0,0) -- ++(0,-\height,0) -- ++(\depth,0,0) -- cycle #1 -- ++(0,0,-\width) -- ++(0,-\height,0) -- ++(0,0,\width) -- cycle  #1 -- ++(-\depth,0,0) -- ++(0,0,-\width) -- ++(\depth,0,0) -- cycle;
    \draw[dashed] #1 -- #6 #1++(0,0,-\width) -- #6 #1++(0,-\height,0) -- #6 #1++(0,-\height,-\width) -- #6;
  \end{scope}
}


\def\kernellabel#1#2#3#4#5#6#7#8#9{
  %#6 is target pixel
  \begin{scope}
    \edef\mycolor{#2}
    \edef\depth{#3}
    \edef\height{#4}
    \edef\width{#5}
    \edef\depthlabel{#7}
    \edef\heightlabel{#8}
    \edef\widthlabel{#9}
    \draw[black,fill=\mycolor] #1 -- ++(-\depth,0,0) -- ++(0,-\height,0) -- ++(\depth,0,0) node[pos=0.5,below] {\tiny \depthlabel} -- cycle #1 -- ++(0,0,-\width) -- ++(0,-\height,0) node[pos=0.5,right] {\tiny \heightlabel} -- ++(0,0,\width)  node[pos=0.5,below] {\tiny \widthlabel} -- cycle  #1 -- ++(-\depth,0,0) -- ++(0,0,-\width) -- ++(\depth,0,0) -- cycle;
    \draw[dashed] #1 -- #6 #1++(0,0,-\width) -- #6 #1++(0,-\height,0) -- #6 #1++(0,-\height,-\width) -- #6;
  \end{scope}
}

\newcommand\myheading[1]{%
\par\bigskip
{\Large\bfseries#1}\par\smallskip}

\tolerance=1
\emergencystretch=\maxdimen
\hyphenpenalty=10000
\hbadness=10000

\newcommand{\tikzmark}[1]{\tikz[baseline,remember picture] \coordinate (#1) {};}

\begin{document}
