def main(): tex_code = bp.header() + "\n" + \ conv.construct_conv_out([64,20,64], [0,0,0], [0,0,0], "depthwise", "depthwise conv", ["height", "width", "depth"], "depthwise") + "\n\n" + \ conv.construct_conv_out([32,20,32], [0,0,0], [5,0,0], "depthwise", "pointwise conv", ["height", "width", "depth"], "pointwise") + "\n\n" + \ bp.footer() print(tex_code) with open("sample.tex", "w") as f: f.write(tex_code) os.system("pdflatex sample")
def add_residual_multi(self, shape, node1, node2, convtype, depth=15, extent=5, early=3): """ This is an expensive operation """ in_pos = self.node_pos_tracker[node1] out_pos = self.node_pos_tracker[node2] pos1 = [in_pos[0], in_pos[1], in_pos[2] + depth] pos2 = [pos1[0] + extent, pos1[1], pos1[2]] # Draw box here pos3 = [out_pos[0] - early, pos2[1], pos2[2]] pos4 = [pos3[0], out_pos[1], out_pos[2]] # Draw concat here tex_code_node = connection.add_connection_simple( None, in_pos, pos1, convtype + "op") self.tex_code = self.tex_code + util.spacing() + tex_code_node tex_code_node = connection.add_connection_simple( None, pos1, pos2, convtype + "op") self.tex_code = self.tex_code + util.spacing() + tex_code_node ## Adding conv here now tex_code_node = conv.construct_conv_out(shape, pos2, "residualdepth1", "residualdepth1", ["", "", ""], "depthwise") #self.update(name, tex_code_node) self.tex_code = self.tex_code + util.spacing() + tex_code_node tex_code_node = connection.add_connection_simple( "residualdepth1", pos2, pos3, convtype + "op") self.tex_code = self.tex_code + util.spacing() + tex_code_node tex_code_node = connection.add_connection_simple( None, pos3, pos4, convtype + "op") self.tex_code = self.tex_code + util.spacing() + tex_code_node
def add_pointwise_tensor(self, name, shape=[32, 3, 32], annotation=["", "", ""]): """ pointwise conv """ tex_code_node = connection.add_connection_simple( self.prev_node, self.prev_pos, self.current_pos, "pointwiseop") self.tex_code = self.tex_code + util.spacing() + tex_code_node tex_code_node = conv.construct_conv_out(shape, self.current_pos, name, name, annotation, "pointwise") self.update(name, tex_code_node)
def add_generic_conv_tensor(self, name, shape=[32, 3, 32], caption="", annotation=["", "", ""], space=0): """ generic conv """ self.current_pos[0] = self.current_pos[0] + space tex_code_node = connection.add_connection_simple( self.prev_node, self.prev_pos, self.current_pos, "genericconvop") self.tex_code = self.tex_code + util.spacing() + tex_code_node tex_code_node = conv.construct_conv_out(shape, self.current_pos, name, caption, annotation, "conv") self.update(name, tex_code_node)