Added LeNet5 example
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,56 @@
|
||||
|
||||
import sys
|
||||
sys.path.append('../')
|
||||
from pycore.tikzeng import *
|
||||
from pycore.blocks import *
|
||||
|
||||
arch = [
|
||||
to_head('..'),
|
||||
to_cor(),
|
||||
to_begin(),
|
||||
|
||||
#input
|
||||
to_input( '9.png', height=7, width=7 ),
|
||||
|
||||
to_Conv("INPUT", 32, 1, offset="(0,0,0)", to="(0,0,0)", height=32, depth=32, width=1, caption="INPUT" ),
|
||||
to_Conv("C1", 28, 6, offset="(1,0,0)", to="(INPUT-east)", height=28, depth=28, width=6, caption="C1" ),
|
||||
to_connection( "INPUT", "C1"),
|
||||
to_Pool("S2", offset="(0,0,0)", to="(C1-east)", height=14, depth=14, width=6, caption="S2"),
|
||||
to_Conv("C3", 10, 16, offset="(1,0,0)", to="(S2-east)", height=10, depth=10, width=16, caption="C3" ),
|
||||
to_connection( "S2", "C3"),
|
||||
to_Pool("S4", offset="(0,0,0)", to="(C3-east)", height=5, depth=5, width=16, caption="S4"),
|
||||
to_Conv("C5", 120, 1, offset="(1,0,0)", to="(S4-east)", height=1, depth=120, width=1, caption="C5" ),
|
||||
to_connection( "S4", "C5"),
|
||||
to_Conv("F6", 84, 1, offset="(1,0,0)", to="(C5-east)", height=1, depth=84, width=1, caption="F6" ),
|
||||
to_connection( "C5", "F6"),
|
||||
to_SoftMax("OUTPUT", 10 ,"(3,0,0)", "(C5-east)", caption="OUTPUT" ),
|
||||
to_connection( "F6", "OUTPUT"),
|
||||
|
||||
# input(32, 32, 1)
|
||||
# conv(28, 28, 6)
|
||||
|
||||
# pool(14, 14, 6)
|
||||
# conv(10, 10, 16)
|
||||
# pool(5, 5, 16)
|
||||
# conv(1,1,120)
|
||||
# fullyconn(1,1,84)
|
||||
# softmax(1,1,10)
|
||||
|
||||
# to_Pool("pool1", offset="(0,0,0)", to="(conv1-east)"),
|
||||
# to_Conv("conv2", 128, 64, offset="(1,0,0)", to="(pool1-east)", height=32, depth=32, width=2 ),
|
||||
#to_connection( "pool1", "conv2"),
|
||||
# to_Pool("pool2", offset="(0,0,0)", to="(conv2-east)", height=28, depth=28, width=1),
|
||||
# to_SoftMax("soft1", 10 ,"(3,0,0)", "(pool1-east)", caption="SOFT" ),
|
||||
# to_connection("pool2", "soft1"),
|
||||
|
||||
to_end()
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
namefile = str(sys.argv[0]).split('.')[0]
|
||||
to_generate(arch, namefile + '.tex' )
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user