Moved from specific definitions(Conv,ConvRelu) to Generic(Box,BandedBox). Also refactored and cleaned the code
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
\ProvidesPackage{Ball}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%This Block can draw small Ball
|
||||
%Elementwise or reduction operations can be drawn with this
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\tikzset{Ball/.pic={\tikzset{/sphere/.cd,#1}
|
||||
|
||||
\pgfmathsetmacro{\r}{\radius*\scale}
|
||||
|
||||
\shade[ball color=\fill,opacity=\opacity] (0,0,0) circle (\r);
|
||||
\draw (0,0,0) circle [radius=\r] node[scale=4*\r] {\logo};
|
||||
|
||||
\coordinate (\name-anchor) at ( 0 , 0 , 0) ;
|
||||
\coordinate (\name-east) at ( \r, 0 , 0) ;
|
||||
\coordinate (\name-west) at (-\r, 0 , 0) ;
|
||||
\coordinate (\name-north) at ( 0 , \r , 0) ;
|
||||
\coordinate (\name-south) at ( 0 , -\r, 0) ;
|
||||
|
||||
\path (\name-south) + (0,-20pt) coordinate (caption-node)
|
||||
edge ["\textcolor{black}{\bf \caption}"'] (caption-node); %Ball caption
|
||||
|
||||
},
|
||||
/sphere/.search also={/tikz},
|
||||
/sphere/.cd,
|
||||
radius/.store in=\radius,
|
||||
scale/.store in=\scale,
|
||||
caption/.store in=\caption,
|
||||
name/.store in=\name,
|
||||
fill/.store in=\fill,
|
||||
logo/.store in=\logo,
|
||||
opacity/.store in=\opacity,
|
||||
logo=$\Sigma$,
|
||||
fill=green,
|
||||
opacity=0.10,
|
||||
scale=0.2,
|
||||
radius=0.5,
|
||||
caption=,
|
||||
name=,
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
\ProvidesPackage{Box}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% This Block can draw simple block of boxes with custom colors.
|
||||
% Can be used for conv, deconv etc
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\tikzset{Box/.pic={\tikzset{/boxblock/.cd,#1}
|
||||
\tikzstyle{box}=[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=\opacity, pic actions,fill=\fill]
|
||||
|
||||
\pgfmathsetmacro{\y}{\cubey*\scale}
|
||||
\pgfmathsetmacro{\z}{\cubez*\scale}
|
||||
|
||||
%Multiple concatenated boxes
|
||||
\foreach[count=\i,%
|
||||
evaluate=\i as \xlabel using {array({\boxlabels},\i-1)},%
|
||||
evaluate=\unscaledx as \k using {\unscaledx*\scale+\prev}, remember=\k as \prev (initially 0)]
|
||||
\unscaledx in \cubex
|
||||
{
|
||||
\pgfmathsetmacro{\x}{\unscaledx*\scale}
|
||||
\coordinate (a) at (\k-\x , \y/2 , \z/2);
|
||||
\coordinate (b) at (\k-\x ,-\y/2 , \z/2);
|
||||
\coordinate (c) at (\k ,-\y/2 , \z/2);
|
||||
\coordinate (d) at (\k , \y/2 , \z/2);
|
||||
\coordinate (e) at (\k , \y/2 ,-\z/2);
|
||||
\coordinate (f) at (\k ,-\y/2 ,-\z/2);
|
||||
\coordinate (g) at (\k-\x ,-\y/2 ,-\z/2);
|
||||
\coordinate (h) at (\k-\x , \y/2 ,-\z/2);
|
||||
|
||||
\draw [box]
|
||||
(d) -- (a) -- (b) -- (c) -- cycle
|
||||
(d) -- (a) -- (h) -- (e) -- cycle
|
||||
%dotted edges
|
||||
(f) edge (g)
|
||||
(b) edge (g)
|
||||
(h) edge (g)
|
||||
;
|
||||
\path (b) edge ["\xlabel"',midway] (c);
|
||||
|
||||
\xdef\LastEastx{\k} %\k persists as \LastEastx after loop
|
||||
}%Loop ends
|
||||
\draw [box] (d) -- (e) -- (f) -- (c) -- cycle; %East face of last box
|
||||
|
||||
\coordinate (a1) at (0 , \y/2 , \z/2);
|
||||
\coordinate (b1) at (0 ,-\y/2 , \z/2);
|
||||
\tikzstyle{depthlabel}=[pos=0,text width=\z,text centered,sloped]
|
||||
|
||||
\path (c) edge ["\small\zlabel"',depthlabel](f); %depth label
|
||||
\path (b1) edge ["\ylabel",midway] (a1); %height label
|
||||
|
||||
|
||||
\tikzstyle{captionlabel}=[text width=15*\LastEastx/\scale,text centered]
|
||||
\path (\LastEastx/2,-\y/2,+\z/2) + (0,-25pt) coordinate (cap)
|
||||
edge ["\textcolor{black}{ \bf \caption}"',captionlabel](cap) ; %Block caption/pic object label
|
||||
|
||||
%Define nodes to be used outside on the pic object
|
||||
\coordinate (\name-west) at (0,0,0) ;
|
||||
\coordinate (\name-east) at (\LastEastx, 0,0) ;
|
||||
\coordinate (\name-north) at (\LastEastx/2,\y/2,0);
|
||||
\coordinate (\name-south) at (\LastEastx/2,-\y/2,0);
|
||||
\coordinate (\name-anchor) at (\LastEastx/2, 0,0) ;
|
||||
|
||||
\coordinate (\name-near) at (\LastEastx/2,0,\z/2);
|
||||
\coordinate (\name-far) at (\LastEastx/2,0,-\z/2);
|
||||
|
||||
\coordinate (\name-nearwest) at (0,0,\z/2);
|
||||
\coordinate (\name-neareast) at (\LastEastx,0,\z/2);
|
||||
\coordinate (\name-farwest) at (0,0,-\z/2);
|
||||
\coordinate (\name-fareast) at (\LastEastx,0,-\z/2);
|
||||
|
||||
\coordinate (\name-northeast) at (\name-north-|\name-east);
|
||||
\coordinate (\name-northwest) at (\name-north-|\name-west);
|
||||
\coordinate (\name-southeast) at (\name-south-|\name-east);
|
||||
\coordinate (\name-southwest) at (\name-south-|\name-west);
|
||||
|
||||
\coordinate (\name-nearnortheast) at (\LastEastx, \y/2, \z/2);
|
||||
\coordinate (\name-farnortheast) at (\LastEastx, \y/2,-\z/2);
|
||||
\coordinate (\name-nearsoutheast) at (\LastEastx,-\y/2, \z/2);
|
||||
\coordinate (\name-farsoutheast) at (\LastEastx,-\y/2,-\z/2);
|
||||
|
||||
\coordinate (\name-nearnorthwest) at (0, \y/2, \z/2);
|
||||
\coordinate (\name-farnorthwest) at (0, \y/2,-\z/2);
|
||||
\coordinate (\name-nearsouthwest) at (0,-\y/2, \z/2);
|
||||
\coordinate (\name-farsouthwest) at (0,-\y/2,-\z/2);
|
||||
|
||||
},
|
||||
/boxblock/.search also={/tikz},
|
||||
/boxblock/.cd,
|
||||
width/.store in=\cubex,
|
||||
height/.store in=\cubey,
|
||||
depth/.store in=\cubez,
|
||||
scale/.store in=\scale,
|
||||
xlabel/.store in=\boxlabels,
|
||||
ylabel/.store in=\ylabel,
|
||||
zlabel/.store in=\zlabel,
|
||||
caption/.store in=\caption,
|
||||
name/.store in=\name,
|
||||
fill/.store in=\fill,
|
||||
opacity/.store in=\opacity,
|
||||
fill={rgb:red,5;green,5;blue,5;white,15},
|
||||
opacity=0.4,
|
||||
width=2,
|
||||
height=13,
|
||||
depth=15,
|
||||
scale=.2,
|
||||
xlabel={{"","","","","","","","","",""}},
|
||||
ylabel=,
|
||||
zlabel=,
|
||||
caption=,
|
||||
name=,
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
\ProvidesPackage{Conv}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%This Block can draw conv combination
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\tikzset{Conv/.pic={\tikzset{/block/.cd,#1}
|
||||
% conv layers
|
||||
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
|
||||
{
|
||||
\draw [conv] (\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(\cubescale*\x,0,0) coordinate (c) -- cycle
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
|
||||
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- ++(+\cubescale*\x,0,0) coordinate (e) -- cycle;
|
||||
% labelling each conv layer with number of filters in each layer
|
||||
\path [every edge/.append style={pic actions}]
|
||||
(b) edge ["\numfilters"',midway] (b -| c);
|
||||
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
|
||||
}
|
||||
\draw [conv]
|
||||
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
|
||||
% Labelling the block
|
||||
\path [every edge/.append style={pic actions}]
|
||||
% name or size of depth dimension
|
||||
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
|
||||
% name or size of height dimension
|
||||
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
|
||||
% Block name
|
||||
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
|
||||
|
||||
\draw (\SecondLastLayerOriginX*\cubescale, 0,0) coordinate (\cubeblockname-east);
|
||||
\draw (0,0,0) coordinate (\cubeblockname-west);
|
||||
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
|
||||
},
|
||||
/block/.search also={/tikz},
|
||||
/block/.cd,
|
||||
width/.store in=\cubex,
|
||||
height/.store in=\cubey,
|
||||
depth/.store in=\cubez,
|
||||
scale/.store in=\cubescale,
|
||||
numFilters/.store in=\cubexlabel,
|
||||
ylabel/.store in=\cubeylabel,
|
||||
zlabel/.store in=\cubezlabel,
|
||||
blocklabel/.store in=\cubeblocklabel,
|
||||
blockname/.store in=\cubeblockname,
|
||||
width=2,
|
||||
height=13,
|
||||
depth=15,
|
||||
scale=.2,
|
||||
numFilters=,
|
||||
ylabel=,
|
||||
zlabel=,
|
||||
blocklabel=,
|
||||
blockname=,
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
\ProvidesPackage{ConvRelu}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%This Block can draw convRelu
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\tikzset{ConvRelu/.pic={\tikzset{/block/.cd,#1}
|
||||
% conv layers
|
||||
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
|
||||
{
|
||||
\draw [relu]
|
||||
(\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(-\cubescale*\x/3,0,0) coordinate (a1) -- ++(0,-\cubescale*\cubey,0) coordinate (b1) -- ++(\cubescale*\x/3,0,0) coordinate (c) -- cycle
|
||||
(d) -- (a1) -- ++(0,0,-\cubescale*\cubez) coordinate (h1) -- ++(+\cubescale*\x/3,0,0) coordinate (e) -- cycle;
|
||||
\draw [conv]
|
||||
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- (c) -- cycle
|
||||
(d) -- (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
|
||||
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- (e) -- cycle;
|
||||
% labelling each conv layer with number of filters in each layer
|
||||
\path [every edge/.append style={pic actions}]
|
||||
(b) edge ["\numfilters"',midway] (b -| c);
|
||||
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
|
||||
}
|
||||
\draw[relu,draw={rgb:black,1}]
|
||||
(d)
|
||||
-- (e)
|
||||
-- ++(0,-\cubescale*\cubey,0) coordinate (f)
|
||||
-- (c) -- cycle;
|
||||
|
||||
\draw [conv]
|
||||
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
|
||||
% Labelling the block
|
||||
\path [every edge/.append style={pic actions}]
|
||||
% name or size of depth dimension
|
||||
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
|
||||
% name or size of height dimension
|
||||
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
|
||||
% Block name
|
||||
%(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
|
||||
% Black Label name
|
||||
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (d)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
|
||||
|
||||
\draw (\SecondLastLayerOriginX*\cubescale, 0,0) coordinate (\cubeblockname-east);
|
||||
\draw (0,0,0) coordinate (\cubeblockname-west);
|
||||
%\draw (0.5*\SecondLastLayerOriginX*\cubescale , -\cubescale*\cubey/2 , -\cubescale*\cubez/2) coordinate (\cubeblockname-center);
|
||||
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
|
||||
},
|
||||
/block/.search also={/tikz},
|
||||
/block/.cd,
|
||||
width/.store in=\cubex,
|
||||
height/.store in=\cubey,
|
||||
depth/.store in=\cubez,
|
||||
scale/.store in=\cubescale,
|
||||
numFilters/.store in=\cubexlabel,
|
||||
ylabel/.store in=\cubeylabel,
|
||||
zlabel/.store in=\cubezlabel,
|
||||
blocklabel/.store in=\cubeblocklabel,
|
||||
blockname/.store in=\cubeblockname,
|
||||
width=2,
|
||||
height=13,
|
||||
depth=15,
|
||||
scale=.2,
|
||||
numFilters=,
|
||||
ylabel=,
|
||||
zlabel=,
|
||||
blocklabel=dsdasfkdas,
|
||||
blockname=a,
|
||||
}
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
\ProvidesPackage{ConvReluPool}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%This Block can draw convRelu+pooling combination
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\tikzset{ConvReluPool/.pic={\tikzset{/block/.cd,#1}
|
||||
% conv layers
|
||||
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
|
||||
{
|
||||
\draw [relu]
|
||||
(\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(-\cubescale*\x/3,0,0) coordinate (a1) -- ++(0,-\cubescale*\cubey,0) coordinate (b1) -- ++(\cubescale*\x/3,0,0) coordinate (c) -- cycle
|
||||
(d) -- (a1) -- ++(0,0,-\cubescale*\cubez) coordinate (h1) -- ++(+\cubescale*\x/3,0,0) coordinate (e) -- cycle;
|
||||
\draw [conv]
|
||||
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- (c) -- cycle
|
||||
(d) -- (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
|
||||
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- (e) -- cycle;
|
||||
% labelling each conv layer with number of filters in each layer
|
||||
\path [every edge/.append style={pic actions}]
|
||||
(b) edge ["\numfilters"',midway] (b -| c);
|
||||
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
|
||||
}
|
||||
% Pooling layer
|
||||
\draw [pool]
|
||||
(\SecondLastLayerOriginX*\cubescale +1*\cubescale,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(-1*\cubescale,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(1*\cubescale,0,0) coordinate (c) -- cycle
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) edge (g) -- (c) -- cycle
|
||||
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- (e) -- cycle;
|
||||
|
||||
% Labelling the block
|
||||
\path [every edge/.append style={pic actions}]
|
||||
% name or size of depth dimension
|
||||
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
|
||||
%(d) edge ["\bf\cubeblockname"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (e)
|
||||
|
||||
% name or size of height dimension
|
||||
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
|
||||
% Block name
|
||||
%(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
|
||||
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (d)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
|
||||
|
||||
\draw (\SecondLastLayerOriginX*\cubescale + 1*\cubescale , 0,0) coordinate (\cubeblockname-east);
|
||||
\draw (0,0,0) coordinate (\cubeblockname-west);
|
||||
|
||||
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
|
||||
\path (\cubeblockname-anchor) -- ++(0,\cubescale*\cubey/2,0) coordinate (\cubeblockname-north);
|
||||
\path (\cubeblockname-anchor) -- ++(0,-\cubescale*\cubey/2,0) coordinate (\cubeblockname-south);
|
||||
\path (\cubeblockname-east) -- ++(-2*\cubescale,\cubescale*\cubey/2,0) coordinate (\cubeblockname-lastnorth);
|
||||
\path (\cubeblockname-east) -- ++(-2*\cubescale,-\cubescale*\cubey/2,0) coordinate (\cubeblockname-lastsouth);
|
||||
},
|
||||
/block/.search also={/tikz},
|
||||
/block/.cd,
|
||||
width/.store in=\cubex,
|
||||
height/.store in=\cubey,
|
||||
depth/.store in=\cubez,
|
||||
scale/.store in=\cubescale,
|
||||
numFilters/.store in=\cubexlabel,
|
||||
ylabel/.store in=\cubeylabel,
|
||||
zlabel/.store in=\cubezlabel,
|
||||
blocklabel/.store in=\cubeblocklabel,
|
||||
blockname/.store in=\cubeblockname,
|
||||
width=2,
|
||||
height=13,
|
||||
depth=15,
|
||||
scale=.2,
|
||||
numFilters=,
|
||||
ylabel=,
|
||||
zlabel=,
|
||||
blocklabel=,
|
||||
blockname=,
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
\ProvidesPackage{Deconv}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%This Block can draw Deconvolution layer
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\tikzset{Deconv/.pic={\tikzset{/block/.cd,#1}
|
||||
% deconv layers
|
||||
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
|
||||
{
|
||||
\draw [deconv] (\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(\cubescale*\x,0,0) coordinate (c) -- cycle
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
|
||||
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- ++(+\cubescale*\x,0,0) coordinate (e) -- cycle;
|
||||
% labelling each conv layer with number of filters in each layer
|
||||
\path [every edge/.append style={pic actions}]
|
||||
(b) edge ["\numfilters"',midway] (b -| c);
|
||||
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
|
||||
}
|
||||
\draw [deconv]
|
||||
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
|
||||
% Labelling the block
|
||||
\path [every edge/.append style={pic actions}]
|
||||
% name or size of depth dimension
|
||||
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
|
||||
% name or size of height dimension
|
||||
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
|
||||
% Block name
|
||||
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
|
||||
|
||||
\draw (\SecondLastLayerOriginX*\cubescale, 0,0) coordinate (\cubeblockname-east);
|
||||
\draw (0,0,0) coordinate (\cubeblockname-west);
|
||||
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
|
||||
\path (\cubeblockname-anchor) -- ++(0,\cubescale*\cubey/2,0) coordinate (\cubeblockname-north);
|
||||
\path (\cubeblockname-anchor) -- ++(0,-\cubescale*\cubey/2,0) coordinate (\cubeblockname-south);
|
||||
|
||||
\path (\cubeblockname-anchor) -- ++(0,0,\cubescale*\cubez/2) coordinate (\cubeblockname-out);
|
||||
},
|
||||
/block/.search also={/tikz},
|
||||
/block/.cd,
|
||||
width/.store in=\cubex,
|
||||
height/.store in=\cubey,
|
||||
depth/.store in=\cubez,
|
||||
scale/.store in=\cubescale,
|
||||
numFilters/.store in=\cubexlabel,
|
||||
ylabel/.store in=\cubeylabel,
|
||||
zlabel/.store in=\cubezlabel,
|
||||
blocklabel/.store in=\cubeblocklabel,
|
||||
blockname/.store in=\cubeblockname,
|
||||
width=2,
|
||||
height=13,
|
||||
depth=15,
|
||||
scale=.2,
|
||||
numFilters=,
|
||||
ylabel=,
|
||||
zlabel=,
|
||||
blocklabel=,
|
||||
blockname=,
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
\ProvidesPackage{DomainTransform}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%This Block can draw generic sequential layer
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
||||
|
||||
\tikzset{DomainTransform/.pic={\tikzset{/block/.cd,#1}
|
||||
% conv layers
|
||||
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
|
||||
{
|
||||
\draw [layer] (\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(\cubescale*\x,0,0) coordinate (c) -- cycle
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
|
||||
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- ++(+\cubescale*\x,0,0) coordinate (e) -- cycle;
|
||||
% labelling each conv layer with number of filters in each layer
|
||||
\path [every edge/.append style={pic actions}]
|
||||
(b) edge ["\numfilters"',midway] (b -| c);
|
||||
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
|
||||
}
|
||||
\draw [layer]
|
||||
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
|
||||
% Labelling the block
|
||||
\path [every edge/.append style={pic actions}]
|
||||
% name or size of depth dimension
|
||||
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
|
||||
% name or size of height dimension
|
||||
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
|
||||
% Block name
|
||||
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
|
||||
|
||||
\draw (\SecondLastLayerOriginX*\cubescale + 2*\cubescale , 0,0) coordinate (\cubeblockname-east);
|
||||
\draw (0,0,0) coordinate (\cubeblockname-west);
|
||||
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
|
||||
\path (\cubeblockname-anchor) -- ++(0,\cubescale*\cubey/2,0) coordinate (\cubeblockname-north);
|
||||
\path (\cubeblockname-anchor) -- ++(0,-\cubescale*\cubey/2,0) coordinate (\cubeblockname-south);
|
||||
|
||||
|
||||
|
||||
},
|
||||
/block/.search also={/tikz},
|
||||
/block/.cd,
|
||||
width/.store in=\cubex,
|
||||
height/.store in=\cubey,
|
||||
depth/.store in=\cubez,
|
||||
scale/.store in=\cubescale,
|
||||
numFilters/.store in=\cubexlabel,
|
||||
ylabel/.store in=\cubeylabel,
|
||||
zlabel/.store in=\cubezlabel,
|
||||
blocklabel/.store in=\cubeblocklabel,
|
||||
blockname/.store in=\cubeblockname,
|
||||
width=2,
|
||||
height=13,
|
||||
depth=15,
|
||||
scale=.2,
|
||||
numFilters=,
|
||||
ylabel=,
|
||||
zlabel=,
|
||||
blocklabel=,
|
||||
blockname=,
|
||||
}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
\ProvidesPackage{FullyConnected}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%This Block can draw conv combination
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\tikzset{FullyConnected/.pic={\tikzset{/block/.cd,#1}
|
||||
% conv layers
|
||||
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
|
||||
{
|
||||
\draw [fullyconn] (\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(\cubescale*\x,0,0) coordinate (c) -- cycle
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
|
||||
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- ++(+\cubescale*\x,0,0) coordinate (e) -- cycle;
|
||||
% labelling each conv layer with number of filters in each layer
|
||||
\path [every edge/.append style={pic actions}]
|
||||
(b) edge ["\numfilters"',midway] (b -| c);
|
||||
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
|
||||
}
|
||||
\draw [fullyconn]
|
||||
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
|
||||
% Labelling the block
|
||||
\path [every edge/.append style={pic actions}]
|
||||
% name or size of depth dimension
|
||||
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
|
||||
% name or size of height dimension
|
||||
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
|
||||
% Block name
|
||||
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
|
||||
|
||||
\draw (\SecondLastLayerOriginX*\cubescale + 2*\cubescale , 0,0) coordinate (\cubeblockname-east);
|
||||
\draw (0,0,0) coordinate (\cubeblockname-west);
|
||||
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
|
||||
},
|
||||
/block/.search also={/tikz},
|
||||
/block/.cd,
|
||||
width/.store in=\cubex,
|
||||
height/.store in=\cubey,
|
||||
depth/.store in=\cubez,
|
||||
scale/.store in=\cubescale,
|
||||
numFilters/.store in=\cubexlabel,
|
||||
ylabel/.store in=\cubeylabel,
|
||||
zlabel/.store in=\cubezlabel,
|
||||
blocklabel/.store in=\cubeblocklabel,
|
||||
blockname/.store in=\cubeblockname,
|
||||
width=2,
|
||||
height=13,
|
||||
depth=15,
|
||||
scale=.2,
|
||||
numFilters=,
|
||||
ylabel=,
|
||||
zlabel=,
|
||||
blocklabel=,
|
||||
blockname=,
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
\ProvidesPackage{FullyConnectedRelu}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%This Block can draw fully connected
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\tikzset{FullyConnectedRelu/.pic={\tikzset{/block/.cd,#1}
|
||||
% conv layers
|
||||
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
|
||||
{
|
||||
\draw [fullyrelu]
|
||||
(\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(-\cubescale*\x/3,0,0) coordinate (a1) -- ++(0,-\cubescale*\cubey,0) coordinate (b1) -- ++(\cubescale*\x/3,0,0) coordinate (c) -- cycle
|
||||
(d) -- (a1) -- ++(0,0,-\cubescale*\cubez) coordinate (h1) -- ++(+\cubescale*\x/3,0,0) coordinate (e) -- cycle;
|
||||
\draw [fullyconn]
|
||||
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- (c) -- cycle
|
||||
(d) -- (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
|
||||
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- (e) -- cycle;
|
||||
% labelling each conv layer with number of filters in each layer
|
||||
\path [every edge/.append style={pic actions}]
|
||||
(b) edge ["\numfilters"',midway] (b -| c);
|
||||
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
|
||||
}
|
||||
\draw [fullyconn]
|
||||
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
|
||||
% Labelling the block
|
||||
\path [every edge/.append style={pic actions}]
|
||||
% name or size of depth dimension
|
||||
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
|
||||
% name or size of height dimension
|
||||
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
|
||||
% Block name
|
||||
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
|
||||
|
||||
\draw (\SecondLastLayerOriginX*\cubescale, 0,0) coordinate (\cubeblockname-east);
|
||||
\draw (0,0,0) coordinate (\cubeblockname-west);
|
||||
%\draw (0.5*\SecondLastLayerOriginX*\cubescale , -\cubescale*\cubey/2 , -\cubescale*\cubez/2) coordinate (\cubeblockname-center);
|
||||
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
|
||||
},
|
||||
/block/.search also={/tikz},
|
||||
/block/.cd,
|
||||
width/.store in=\cubex,
|
||||
height/.store in=\cubey,
|
||||
depth/.store in=\cubez,
|
||||
scale/.store in=\cubescale,
|
||||
numFilters/.store in=\cubexlabel,
|
||||
ylabel/.store in=\cubeylabel,
|
||||
zlabel/.store in=\cubezlabel,
|
||||
blocklabel/.store in=\cubeblocklabel,
|
||||
blockname/.store in=\cubeblockname,
|
||||
width=2,
|
||||
height=13,
|
||||
depth=15,
|
||||
scale=.2,
|
||||
numFilters=,
|
||||
ylabel=,
|
||||
zlabel=,
|
||||
blocklabel=,
|
||||
blockname=,
|
||||
}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
\ProvidesPackage{Conv}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%This Block can draw conv combination
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\tikzset{Conv/.pic={\tikzset{/block/.cd,#1}
|
||||
% conv layers
|
||||
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
|
||||
{
|
||||
\draw [conv] (\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(\cubescale*\x,0,0) coordinate (c) -- cycle
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
|
||||
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- ++(+\cubescale*\x,0,0) coordinate (e) -- cycle;
|
||||
% labelling each conv layer with number of filters in each layer
|
||||
\path [every edge/.append style={pic actions}]
|
||||
(b) edge ["\numfilters"',midway] (b -| c);
|
||||
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
|
||||
}
|
||||
\draw [conv]
|
||||
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
|
||||
% Labelling the block
|
||||
\path [every edge/.append style={pic actions}]
|
||||
% name or size of depth dimension
|
||||
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
|
||||
% name or size of height dimension
|
||||
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
|
||||
% Block name
|
||||
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
|
||||
|
||||
\draw (\SecondLastLayerOriginX*\cubescale, 0,0) coordinate (\cubeblockname-east);
|
||||
\draw (0,0,0) coordinate (\cubeblockname-west);
|
||||
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
|
||||
},
|
||||
/block/.search also={/tikz},
|
||||
/block/.cd,
|
||||
width/.store in=\cubex,
|
||||
height/.store in=\cubey,
|
||||
depth/.store in=\cubez,
|
||||
scale/.store in=\cubescale,
|
||||
numFilters/.store in=\cubexlabel,
|
||||
ylabel/.store in=\cubeylabel,
|
||||
zlabel/.store in=\cubezlabel,
|
||||
blocklabel/.store in=\cubeblocklabel,
|
||||
blockname/.store in=\cubeblockname,
|
||||
width=2,
|
||||
height=13,
|
||||
depth=15,
|
||||
scale=.2,
|
||||
numFilters=,
|
||||
ylabel=,
|
||||
zlabel=,
|
||||
blocklabel=,
|
||||
blockname=,
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
\ProvidesPackage{GenericSequentialLayer}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%This Block can draw generic sequential layer
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\tikzset{GenericSequentialLayer/.pic={\tikzset{/block/.cd,#1}
|
||||
% conv layers
|
||||
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
|
||||
{
|
||||
\draw [layer] (\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(\cubescale*\x,0,0) coordinate (c) -- cycle
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
|
||||
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- ++(+\cubescale*\x,0,0) coordinate (e) -- cycle;
|
||||
% labelling each conv layer with number of filters in each layer
|
||||
\path [every edge/.append style={pic actions}]
|
||||
(b) edge ["\numfilters"',midway] (b -| c);
|
||||
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
|
||||
}
|
||||
\draw [layer]
|
||||
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
|
||||
% Labelling the block
|
||||
\path [every edge/.append style={pic actions}]
|
||||
% name or size of depth dimension
|
||||
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
|
||||
% name or size of height dimension
|
||||
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
|
||||
% Block name
|
||||
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
|
||||
|
||||
\draw (\SecondLastLayerOriginX*\cubescale + 2*\cubescale , 0,0) coordinate (\cubeblockname-east);
|
||||
\draw (0,0,0) coordinate (\cubeblockname-west);
|
||||
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
|
||||
\path (\cubeblockname-anchor) -- ++(0,\cubescale*\cubey/2,0) coordinate (\cubeblockname-north);
|
||||
\path (\cubeblockname-anchor) -- ++(0,-\cubescale*\cubey/2,0) coordinate (\cubeblockname-south);
|
||||
},
|
||||
/block/.search also={/tikz},
|
||||
/block/.cd,
|
||||
width/.store in=\cubex,
|
||||
height/.store in=\cubey,
|
||||
depth/.store in=\cubez,
|
||||
scale/.store in=\cubescale,
|
||||
numFilters/.store in=\cubexlabel,
|
||||
ylabel/.store in=\cubeylabel,
|
||||
zlabel/.store in=\cubezlabel,
|
||||
blocklabel/.store in=\cubeblocklabel,
|
||||
blockname/.store in=\cubeblockname,
|
||||
width=2,
|
||||
height=13,
|
||||
depth=15,
|
||||
scale=.2,
|
||||
numFilters=,
|
||||
ylabel=,
|
||||
zlabel=,
|
||||
blocklabel=,
|
||||
blockname=,
|
||||
}
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
\ProvidesPackage{Gray}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%This Block can draw Deconvolution layer
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\tikzset{Gray/.pic={\tikzset{/block/.cd,#1}
|
||||
% gray layers
|
||||
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
|
||||
{
|
||||
\draw [gray] (\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(\cubescale*\x,0,0) coordinate (c) -- cycle
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
|
||||
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- ++(+\cubescale*\x,0,0) coordinate (e) -- cycle;
|
||||
% labelling each conv layer with number of filters in each layer
|
||||
\path [every edge/.append style={pic actions}]
|
||||
(b) edge ["\numfilters"',midway] (b -| c);
|
||||
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
|
||||
}
|
||||
\draw [gray]
|
||||
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
|
||||
% Labelling the block
|
||||
\path [every edge/.append style={pic actions}]
|
||||
% name or size of depth dimension
|
||||
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
|
||||
% name or size of height dimension
|
||||
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
|
||||
% Block name
|
||||
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
|
||||
|
||||
\draw (\SecondLastLayerOriginX*\cubescale, 0,0) coordinate (\cubeblockname-east);
|
||||
\draw (0,0,0) coordinate (\cubeblockname-west);
|
||||
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
|
||||
\path (\cubeblockname-anchor) -- ++(0,\cubescale*\cubey/2,0) coordinate (\cubeblockname-north);
|
||||
\path (\cubeblockname-anchor) -- ++(0,-\cubescale*\cubey/2,0) coordinate (\cubeblockname-south);
|
||||
\path (\cubeblockname-anchor) -- ++(0,0,\cubescale*\cubez/2) coordinate (\cubeblockname-out);
|
||||
},
|
||||
/block/.search also={/tikz},
|
||||
/block/.cd,
|
||||
width/.store in=\cubex,
|
||||
height/.store in=\cubey,
|
||||
depth/.store in=\cubez,
|
||||
scale/.store in=\cubescale,
|
||||
numFilters/.store in=\cubexlabel,
|
||||
ylabel/.store in=\cubeylabel,
|
||||
zlabel/.store in=\cubezlabel,
|
||||
blocklabel/.store in=\cubeblocklabel,
|
||||
blockname/.store in=\cubeblockname,
|
||||
width=2,
|
||||
height=13,
|
||||
depth=15,
|
||||
scale=.2,
|
||||
numFilters=,
|
||||
ylabel=,
|
||||
zlabel=,
|
||||
blocklabel=,
|
||||
blockname=,
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
\ProvidesPackage{Multiply}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%This Block can draw Elementwise operations
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\tikzset{Multiply/.pic={\tikzset{/block/.cd,#1}
|
||||
|
||||
\draw (0,0,0) circle (\SphereRadius);
|
||||
|
||||
\draw (0,0,0) coordinate (\cubeblockname-anchor);
|
||||
\draw (\SphereRadius,0,0) coordinate (\cubeblockname-east);
|
||||
\draw (-\SphereRadius,0,0) coordinate (\cubeblockname-west);
|
||||
\draw (0,\SphereRadius,0) coordinate (\cubeblockname-north);
|
||||
\draw (0,-\SphereRadius,0) coordinate (\cubeblockname-south);
|
||||
|
||||
\draw[very thick] (-2*\SphereRadius/4,-2*\SphereRadius/4,0) -- (2*\SphereRadius/4,2*\SphereRadius/4,0);
|
||||
\draw[very thick] (2*\SphereRadius/4,-2*\SphereRadius/4,0) -- (-2*\SphereRadius/4,2*\SphereRadius/4,0);
|
||||
|
||||
\shade[ball color=blue,opacity=0.30] (0,0,0) circle (\SphereRadius);
|
||||
|
||||
},
|
||||
/block/.search also={/tikz},
|
||||
/block/.cd,
|
||||
width/.store in=\cubex,
|
||||
height/.store in=\cubey,
|
||||
depth/.store in=\cubez,
|
||||
scale/.store in=\cubescale,
|
||||
numFilters/.store in=\cubexlabel,
|
||||
ylabel/.store in=\cubeylabel,
|
||||
radius/.store in=\SphereRadius,
|
||||
blocklabel/.store in=\cubeblocklabel,
|
||||
blockname/.store in=\cubeblockname,
|
||||
width=2,
|
||||
height=13,
|
||||
depth=15,
|
||||
scale=.2,
|
||||
numFilters=,
|
||||
ylabel=,
|
||||
radius=0.5,
|
||||
blocklabel=,
|
||||
blockname=,
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
\ProvidesPackage{RightBandedBox}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% This Block can draw simple block of boxes with custom colors.
|
||||
% Can be used for conv, deconv etc
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\tikzset{RightBandedBox/.pic={\tikzset{/block/.cd,#1}
|
||||
|
||||
\tikzstyle{box}=[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=\opacity, pic actions,fill=\fill]
|
||||
|
||||
\tikzstyle{band}=[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=\bandopacity, pic actions,fill=\bandfill,draw=\bandfill]
|
||||
|
||||
\pgfmathsetmacro{\y}{\cubey*\scale}
|
||||
\pgfmathsetmacro{\z}{\cubez*\scale}
|
||||
|
||||
%Multiple concatenated boxes
|
||||
\foreach[count=\i,%
|
||||
evaluate=\i as \xlabel using {array({\boxlabels},\i-1)},%
|
||||
evaluate=\unscaledx as \k using {\unscaledx*\scale+\prev}, remember=\k as \prev (initially 0)]
|
||||
\unscaledx in \cubex
|
||||
{
|
||||
\pgfmathsetmacro{\x}{\unscaledx*\scale}
|
||||
\coordinate (a) at (\k-\x , \y/2 , \z/2);
|
||||
\coordinate (art) at (\k-\x/3 , \y/2 , \z/2); %a_right_third
|
||||
\coordinate (b) at (\k-\x ,-\y/2 , \z/2);
|
||||
\coordinate (brt) at (\k-\x/3 ,-\y/2 , \z/2); %b_right_third
|
||||
\coordinate (c) at (\k ,-\y/2 , \z/2);
|
||||
\coordinate (d) at (\k , \y/2 , \z/2);
|
||||
\coordinate (e) at (\k , \y/2 ,-\z/2);
|
||||
\coordinate (f) at (\k ,-\y/2 ,-\z/2);
|
||||
\coordinate (g) at (\k-\x ,-\y/2 ,-\z/2);
|
||||
\coordinate (h) at (\k-\x , \y/2 ,-\z/2);
|
||||
\coordinate (hrt) at (\k-\x/3 , \y/2 ,-\z/2); %h_right_third
|
||||
|
||||
%fill box color
|
||||
\draw [box]
|
||||
(d) -- (a) -- (b) -- (c) -- cycle
|
||||
(d) -- (a) -- (h) -- (e) -- cycle;
|
||||
%dotted edges
|
||||
\draw [box]
|
||||
(f) edge (g)
|
||||
(b) edge (g)
|
||||
(h) edge (g);
|
||||
%fill band color
|
||||
\draw [band]
|
||||
(d) -- (art) -- (brt) -- (c) -- cycle
|
||||
(d) -- (art) -- (hrt) -- (e) -- cycle;
|
||||
%draw edges again which were covered by band
|
||||
\draw [box,fill opacity=0]
|
||||
(d) -- (a) -- (b) -- (c) -- cycle
|
||||
(d) -- (a) -- (h) -- (e) -- cycle;
|
||||
|
||||
\path (b) edge ["\xlabel"',midway] (c);
|
||||
|
||||
\xdef\LastEastx{\k} %\k persists as \LastEastx after loop
|
||||
}%Loop ends
|
||||
\draw [box] (d) -- (e) -- (f) -- (c) -- cycle; %East face of last box
|
||||
\draw [band] (d) -- (e) -- (f) -- (c) -- cycle; %East face of last box
|
||||
\draw [pic actions] (d) -- (e) -- (f) -- (c) -- cycle; %East face edges of last box
|
||||
|
||||
\coordinate (a1) at (0 , \y/2 , \z/2);
|
||||
\coordinate (b1) at (0 ,-\y/2 , \z/2);
|
||||
\tikzstyle{depthlabel}=[pos=0,text width=14*\z,text centered,sloped]
|
||||
|
||||
\path (c) edge ["\small\zlabels"',depthlabel](f); %depth label
|
||||
\path (b1) edge ["\ylabel",midway] (a1); %height label
|
||||
|
||||
\tikzstyle{captionlabel}=[text width=15*\LastEastx/\scale,text centered]
|
||||
\path (\LastEastx/2,-\y/2,+\z/2) + (0,-25pt) coordinate (cap)
|
||||
edge ["\textcolor{black}{ \bf \caption}"',captionlabel] (cap); %Block caption/pic object label
|
||||
|
||||
%Define nodes to be used outside on the pic object
|
||||
\coordinate (\name-west) at (0,0,0) ;
|
||||
\coordinate (\name-east) at (\LastEastx, 0,0) ;
|
||||
\coordinate (\name-north) at (\LastEastx/2,\y/2,0);
|
||||
\coordinate (\name-south) at (\LastEastx/2,-\y/2,0);
|
||||
\coordinate (\name-anchor) at (\LastEastx/2, 0,0) ;
|
||||
|
||||
\coordinate (\name-near) at (\LastEastx/2,0,\z/2);
|
||||
\coordinate (\name-far) at (\LastEastx/2,0,-\z/2);
|
||||
|
||||
\coordinate (\name-nearwest) at (0,0,\z/2);
|
||||
\coordinate (\name-neareast) at (\LastEastx,0,\z/2);
|
||||
\coordinate (\name-farwest) at (0,0,-\z/2);
|
||||
\coordinate (\name-fareast) at (\LastEastx,0,-\z/2);
|
||||
|
||||
\coordinate (\name-northeast) at (\name-north-|\name-east);
|
||||
\coordinate (\name-northwest) at (\name-north-|\name-west);
|
||||
\coordinate (\name-southeast) at (\name-south-|\name-east);
|
||||
\coordinate (\name-southwest) at (\name-south-|\name-west);
|
||||
|
||||
\coordinate (\name-nearnortheast) at (\LastEastx, \y/2, \z/2);
|
||||
\coordinate (\name-farnortheast) at (\LastEastx, \y/2,-\z/2);
|
||||
\coordinate (\name-nearsoutheast) at (\LastEastx,-\y/2, \z/2);
|
||||
\coordinate (\name-farsoutheast) at (\LastEastx,-\y/2,-\z/2);
|
||||
|
||||
\coordinate (\name-nearnorthwest) at (0, \y/2, \z/2);
|
||||
\coordinate (\name-farnorthwest) at (0, \y/2,-\z/2);
|
||||
\coordinate (\name-nearsouthwest) at (0,-\y/2, \z/2);
|
||||
\coordinate (\name-farsouthwest) at (0,-\y/2,-\z/2);
|
||||
},
|
||||
/block/.search also={/tikz},
|
||||
/block/.cd,
|
||||
width/.store in=\cubex,
|
||||
height/.store in=\cubey,
|
||||
depth/.store in=\cubez,
|
||||
scale/.store in=\scale,
|
||||
xlabel/.store in=\boxlabels,
|
||||
ylabel/.store in=\ylabel,
|
||||
zlabel/.store in=\zlabels,
|
||||
caption/.store in=\caption,
|
||||
name/.store in=\name,
|
||||
fill/.store in=\fill,
|
||||
bandfill/.store in=\bandfill,
|
||||
opacity/.store in=\opacity,
|
||||
bandopacity/.store in=\bandopacity,
|
||||
fill={rgb:red,5;green,5;blue,5;white,15},
|
||||
bandfill={rgb:red,5;green,5;blue,5;white,5},
|
||||
opacity=0.4,
|
||||
bandopacity=0.6,
|
||||
width=2,
|
||||
height=13,
|
||||
depth=15,
|
||||
scale=.2,
|
||||
xlabel={{"","","","","","","","","",""}},
|
||||
ylabel=,
|
||||
zlabel=,
|
||||
caption=,
|
||||
name=,
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
\ProvidesPackage{SigmaSum}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%This Block can draw Reduction sum operations
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\tikzset{SigmaSum/.pic={\tikzset{/block/.cd,#1}
|
||||
|
||||
\draw (0,0,0) circle [radius=\SphereRadius] node[scale=4*\SphereRadius] {$\Sigma$};
|
||||
|
||||
\draw (0,0,0) coordinate (\cubeblockname-anchor);
|
||||
\draw (\SphereRadius,0,0) coordinate (\cubeblockname-east);
|
||||
\draw (-\SphereRadius,0,0) coordinate (\cubeblockname-west);
|
||||
\draw (0,\SphereRadius,0) coordinate (\cubeblockname-north);
|
||||
\draw (0,-\SphereRadius,0) coordinate (\cubeblockname-south);
|
||||
|
||||
%\draw[very thick] (-2*\SphereRadius/4,-2*\SphereRadius/4,0) -- (2*\SphereRadius/4,2*\SphereRadius/4,0);
|
||||
%\draw [very thick] (c1-east)++(0,\up,0) node [anchor=south west, inner sep = 10, xshift=10,scale=1.2]{$p_{i,j}^{(k)} - p_{(i+\Delta i),(j+\Delta j)}^{(k)}$} -- node {\midarrow} (abs1-west-up);
|
||||
|
||||
\shade[ball color=green,opacity=0.30] (0,0,0) circle (\SphereRadius);
|
||||
|
||||
},
|
||||
/block/.search also={/tikz},
|
||||
/block/.cd,
|
||||
width/.store in=\cubex,
|
||||
height/.store in=\cubey,
|
||||
depth/.store in=\cubez,
|
||||
scale/.store in=\cubescale,
|
||||
numFilters/.store in=\cubexlabel,
|
||||
ylabel/.store in=\cubeylabel,
|
||||
radius/.store in=\SphereRadius,
|
||||
blocklabel/.store in=\cubeblocklabel,
|
||||
blockname/.store in=\cubeblockname,
|
||||
width=2,
|
||||
height=13,
|
||||
depth=15,
|
||||
scale=.2,
|
||||
numFilters=,
|
||||
ylabel=,
|
||||
radius=0.5,
|
||||
blocklabel=,
|
||||
blockname=,
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
\ProvidesPackage{Sum}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%This Block can draw Elementwise operations
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\tikzset{Sum/.pic={\tikzset{/block/.cd,#1}
|
||||
|
||||
\draw (0,0,0) circle (\SphereRadius);
|
||||
|
||||
\draw (0,0,0) coordinate (\cubeblockname-anchor);
|
||||
\draw (\SphereRadius,0,0) coordinate (\cubeblockname-east);
|
||||
\draw (-\SphereRadius,0,0) coordinate (\cubeblockname-west);
|
||||
\draw (0,\SphereRadius,0) coordinate (\cubeblockname-north);
|
||||
\draw (0,-\SphereRadius,0) coordinate (\cubeblockname-south);
|
||||
|
||||
\draw[very thick] (-2*\SphereRadius/4,0,0) -- (2*\SphereRadius/4,0,0);
|
||||
\draw[very thick] (0,-2*\SphereRadius/4,0) -- (0,2*\SphereRadius/4,0);
|
||||
|
||||
\shade[ball color=blue,opacity=0.30] (0,0,0) circle (\SphereRadius);
|
||||
|
||||
},
|
||||
/block/.search also={/tikz},
|
||||
/block/.cd,
|
||||
width/.store in=\cubex,
|
||||
height/.store in=\cubey,
|
||||
depth/.store in=\cubez,
|
||||
scale/.store in=\cubescale,
|
||||
numFilters/.store in=\cubexlabel,
|
||||
ylabel/.store in=\cubeylabel,
|
||||
radius/.store in=\SphereRadius,
|
||||
blocklabel/.store in=\cubeblocklabel,
|
||||
blockname/.store in=\cubeblockname,
|
||||
width=2,
|
||||
height=13,
|
||||
depth=15,
|
||||
scale=.2,
|
||||
numFilters=,
|
||||
ylabel=,
|
||||
radius=0.5,
|
||||
blocklabel=,
|
||||
blockname=,
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
\ProvidesPackage{Up}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%This Block can draw Deconvolution layer
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\tikzset{Up/.pic={\tikzset{/block/.cd,#1}
|
||||
% deconv layers
|
||||
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
|
||||
{
|
||||
\draw [up] (\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(-\cubescale*\x,0,0) coordinate (a) -- ++(0,-\cubescale*\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez) -- ++(\cubescale*\x,0,0) coordinate (c) -- cycle
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0) (f) edge (g)
|
||||
(d) -- (a) -- ++(0,0,-\cubescale*\cubez) coordinate (h) edge (g) -- ++(+\cubescale*\x,0,0) coordinate (e) -- cycle;
|
||||
% labelling each conv layer with number of filters in each layer
|
||||
\path [every edge/.append style={pic actions}]
|
||||
(b) edge ["\numfilters"',midway] (b -| c);
|
||||
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
|
||||
}
|
||||
\draw [up]
|
||||
(\SecondLastLayerOriginX*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate
|
||||
(d) -- ++(0,0,-\cubescale*\cubez) coordinate (e) -- ++(0,-\cubescale*\cubey,0) coordinate (f) -- (c) -- cycle ;
|
||||
% Labelling the block
|
||||
\path [every edge/.append style={pic actions}]
|
||||
% name or size of depth dimension
|
||||
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
|
||||
% name or size of height dimension
|
||||
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
|
||||
% Block name
|
||||
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
|
||||
|
||||
\draw (\SecondLastLayerOriginX*\cubescale, 0,0) coordinate (\cubeblockname-east);
|
||||
\draw (0,0,0) coordinate (\cubeblockname-west);
|
||||
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
|
||||
\path (\cubeblockname-anchor) -- ++(0,\cubescale*\cubey/2,0) coordinate (\cubeblockname-north);
|
||||
\path (\cubeblockname-anchor) -- ++(0,-\cubescale*\cubey/2,0) coordinate (\cubeblockname-south);
|
||||
|
||||
\path (\cubeblockname-anchor) -- ++(0,0,\cubescale*\cubez/2) coordinate (\cubeblockname-out);
|
||||
},
|
||||
/block/.search also={/tikz},
|
||||
/block/.cd,
|
||||
width/.store in=\cubex,
|
||||
height/.store in=\cubey,
|
||||
depth/.store in=\cubez,
|
||||
scale/.store in=\cubescale,
|
||||
numFilters/.store in=\cubexlabel,
|
||||
ylabel/.store in=\cubeylabel,
|
||||
zlabel/.store in=\cubezlabel,
|
||||
blocklabel/.store in=\cubeblocklabel,
|
||||
blockname/.store in=\cubeblockname,
|
||||
width=2,
|
||||
height=13,
|
||||
depth=15,
|
||||
scale=.2,
|
||||
numFilters=,
|
||||
ylabel=,
|
||||
zlabel=,
|
||||
blocklabel=,
|
||||
blockname=,
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
\ProvidesPackage{UpConvRelu}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%This Block can draw Upsampling+convRelu combination
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\tikzset{UpConvRelu/.pic={\tikzset{/block/.cd,#1}
|
||||
|
||||
% Upsampling layer
|
||||
\draw [deconv,fill=\upcolor]
|
||||
(0,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate (d)
|
||||
-- ++(-1*\cubescale,0,0) coordinate (a)
|
||||
-- ++(0,-\cubescale*\cubey,0) coordinate (b)
|
||||
edge coordinate[pos=1] (g) ++(0,0,-\cubescale*\cubez)
|
||||
-- ++(1*\cubescale,0,0) coordinate (c)
|
||||
edge coordinate[pos=1] (f) ++(0,0,-\cubescale*\cubez)
|
||||
-- cycle
|
||||
|
||||
|
||||
(d)
|
||||
-- ++(0,0,-\cubescale*\cubez) coordinate (e)
|
||||
edge (f)
|
||||
-- ++(-\cubescale*1,0,0) coordinate (h)
|
||||
edge (g)
|
||||
-- (a)
|
||||
-- cycle
|
||||
|
||||
(g) edge (f)
|
||||
;
|
||||
|
||||
\fill[deconv] (e)--(f)--(g)--(h)--cycle;
|
||||
\fill[deconv] (c)--(f)--(g)--(b)--cycle;
|
||||
\fill[deconv] (a)--(b)--(g)--(h)--cycle;
|
||||
|
||||
\path (d) -- ++(-1*\cubescale,0,-\cubescale*\cubez/2) coordinate (\cubeblockname-upnorth);
|
||||
\path (c) -- ++(-1*\cubescale,0,-\cubescale*\cubez/2) coordinate (\cubeblockname-upsouth);
|
||||
|
||||
%% conv layers
|
||||
\foreach \x [ count=\i,evaluate=\x as \numfilters using {array({\cubexlabel},\i-1)}, evaluate=\x as \k using {\x+\prev}, remember=\k as \prev (initially 0)] in \cubex
|
||||
{
|
||||
\draw [relu,fill=\fillcolor,draw=\fillcolor]
|
||||
(\k*\cubescale ,\cubescale*\cubey/2 , \cubescale*\cubez/2) coordinate (d)
|
||||
-- ++(-\cubescale*\x/3,0,0) coordinate (a1)
|
||||
-- ++(0,-\cubescale*\cubey,0) coordinate (b1)
|
||||
-- ++(\cubescale*\x/3,0,0) coordinate (c) -- cycle
|
||||
|
||||
(d)
|
||||
-- (a1)
|
||||
-- ++(0,0,-\cubescale*\cubez) coordinate (h1)
|
||||
-- ++(+\cubescale*\x/3,0,0) coordinate (e) -- cycle
|
||||
;
|
||||
\draw [conv,fill=\fillcolor]
|
||||
(d)
|
||||
-- ++(-\cubescale*\x,0,0) coordinate (a)
|
||||
-- ++(0,-\cubescale*\cubey,0) coordinate (b)
|
||||
edge coordinate [pos=1] (g) ++(0,0,-\cubescale*\cubez)
|
||||
-- (c) -- cycle
|
||||
|
||||
(d)
|
||||
-- (e)
|
||||
edge coordinate[pos=1] (f) ++(0,-\cubescale*\cubey,0)
|
||||
|
||||
(f)
|
||||
edge (g)
|
||||
|
||||
(d)
|
||||
-- (a)
|
||||
-- ++(0,0,-\cubescale*\cubez) coordinate (h)
|
||||
edge (g)
|
||||
-- (e) -- cycle;
|
||||
% labelling each conv layer with number of filters in each layer
|
||||
\path [every edge/.append style={pic actions}]
|
||||
(b) edge ["\numfilters"',midway] (b -| c);
|
||||
\xdef\SecondLastLayerOriginX{\k} %making value of \k available after the loop as well
|
||||
}
|
||||
\draw[relu,fill=\fillcolor,draw={rgb:black,1}]
|
||||
(d)
|
||||
-- (e)
|
||||
-- ++(0,-\cubescale*\cubey,0) coordinate (f)
|
||||
-- (c) -- cycle;
|
||||
|
||||
|
||||
|
||||
|
||||
% Labelling the block
|
||||
\path [every edge/.append style={pic actions}]
|
||||
% name or size of depth dimension
|
||||
(c) edge ["\small\cubezlabel"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (f)
|
||||
%(d) edge ["\bf\cubeblockname"',pos=0,text width=14*\cubescale*\cubez,text centered,sloped] (e)
|
||||
|
||||
% name or size of height dimension
|
||||
(0,0,\cubez*\cubescale/2) coordinate (o) edge ["\cubeylabel",midway] (o |- o)
|
||||
% Block name
|
||||
%(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (o)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
|
||||
(0,-\cubey*\cubescale/2,+\cubez*\cubescale/2) coordinate (d)+(0,-20pt) coordinate (o1) edge ["\textcolor{black}{ \bf \cubeblocklabel}"',midway,white] (o1 -| c) ;
|
||||
|
||||
\draw (\SecondLastLayerOriginX*\cubescale, 0,0) coordinate (\cubeblockname-east);
|
||||
\draw (0,0,0) coordinate (\cubeblockname-west);
|
||||
\path (\cubeblockname-west) -- (\cubeblockname-east) coordinate[pos=0.5] (\cubeblockname-anchor);
|
||||
\path (\cubeblockname-anchor) -- ++(0,\cubescale*\cubey/2,0) coordinate (\cubeblockname-north);
|
||||
\path (\cubeblockname-anchor) -- ++(0,-\cubescale*\cubey/2,0) coordinate (\cubeblockname-south);
|
||||
},
|
||||
/block/.search also={/tikz},
|
||||
/block/.cd,
|
||||
width/.store in=\cubex,
|
||||
height/.store in=\cubey,
|
||||
depth/.store in=\cubez,
|
||||
scale/.store in=\cubescale,
|
||||
numFilters/.store in=\cubexlabel,
|
||||
ylabel/.store in=\cubeylabel,
|
||||
zlabel/.store in=\cubezlabel,
|
||||
blocklabel/.store in=\cubeblocklabel,
|
||||
blockname/.store in=\cubeblockname,
|
||||
fillcolor/.store in=\fillcolor,
|
||||
upcolor/.store in=\upcolor,
|
||||
fillcolor = {rgb:yellow,5;red,5;white,5},
|
||||
upcolor = {rgb:blue,5;green,2.5;white,5},
|
||||
width=2,
|
||||
height=13,
|
||||
depth=15,
|
||||
scale=.2,
|
||||
numFilters=,
|
||||
ylabel=,
|
||||
zlabel=,
|
||||
blocklabel=,
|
||||
blockname=,
|
||||
}
|
||||
+3
-27
@@ -2,34 +2,10 @@
|
||||
\usetikzlibrary{quotes,arrows.meta}
|
||||
\usetikzlibrary{positioning}
|
||||
|
||||
\newcommand*{\SecondLastLayerOriginX}{No value}
|
||||
\def\edgecolor{rgb:blue,4;red,1;green,4;black,3}
|
||||
\newcommand{\midarrow}{\tikz \draw[-Stealth,line width =0.8mm,draw=\edgecolor] (-0.3,0) -- ++(0.3,0);}
|
||||
|
||||
\tikzstyle{conv} =[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.4, pic actions, fill={rgb:yellow,5;red,2.5;white,5}]
|
||||
\tikzstyle{relu} =[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.6, pic actions, fill={rgb:yellow,5;red,5;white,5},draw={rgb:yellow,5;red,5;white,5}]
|
||||
\tikzstyle{pool} =[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.6, pic actions, fill={rgb:red,1;black,0.3}]% colour coeff will be normalized to 1
|
||||
\tikzstyle{deconv}=[every edge/.append style={pic actions, densely dashed, opacity=.5},fill opacity=0.7, pic actions, fill={rgb:blue,5;green,2.5;white,5}]
|
||||
\tikzstyle{gray}=[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.4, pic actions, fill={rgb:black,5;white,5}]
|
||||
\tikzstyle{up}=[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.5, pic actions, fill={rgb:blue,5;green,2.5;white,1}]
|
||||
\tikzstyle{layer} =[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.4, pic actions]
|
||||
\tikzstyle{fullyconn} =[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.4, pic actions, fill={rgb:blue,5;red,2.5;white,5}]
|
||||
\tikzstyle{fullyrelu} =[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.6, pic actions, fill={rgb:blue,5;red,5;white,4},draw={rgb:blue,5;red,5;white,4}]
|
||||
\tikzstyle{DT} =[every edge/.append style={pic actions, densely dashed, opacity=.7},fill opacity=0.4, pic actions, fill={rgb:blue,1;red,2;green,4;white,7}]
|
||||
|
||||
\usepackage{ConvReluPool}
|
||||
\usepackage{Gray}
|
||||
\usepackage{ConvRelu}
|
||||
\usepackage{Conv}
|
||||
\usepackage{Deconv}
|
||||
\usepackage{UpConvRelu}
|
||||
\usepackage{Up}
|
||||
%\usepackage{Eltwise}
|
||||
\usepackage{Multiply}
|
||||
\usepackage{Sum}
|
||||
\usepackage{SigmaSum}
|
||||
\usepackage{FullyConnected}
|
||||
\usepackage{FullyConnectedRelu}
|
||||
\usepackage{DomainTransform}
|
||||
\usepackage{GenericSequentialLayer}
|
||||
\usepackage{Ball}
|
||||
\usepackage{Box}
|
||||
\usepackage{RightBandedBox}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user