import torch
import torch.nn as nn
import torch.legacy.nn as lnn

from functools import reduce
from torch.autograd import Variable

class LambdaBase(nn.Sequential):
    def __init__(self, fn, *args):
        super(LambdaBase, self).__init__(*args)
        self.lambda_func = fn

    def forward_prepare(self, input):
        output = []
        for module in self._modules.values():
            output.append(module(input))
        return output if output else input

class Lambda(LambdaBase):
    def forward(self, input):
        return self.lambda_func(self.forward_prepare(input))

class LambdaMap(LambdaBase):
    def forward(self, input):
        return list(map(self.lambda_func,self.forward_prepare(input)))

class LambdaReduce(LambdaBase):
    def forward(self, input):
        return reduce(self.lambda_func,self.forward_prepare(input))


vrn_unguided = nn.Sequential( # Sequential,
	nn.Conv2d(3,64,(7, 7),(2, 2),(3, 3)),
	nn.BatchNorm2d(64),
	nn.ReLU(),
	nn.Sequential( # Sequential,
		LambdaMap(lambda x: x, # ConcatTable,
			nn.Sequential( # Sequential,
				nn.BatchNorm2d(64),
				nn.ReLU(),
				nn.Conv2d(64,64,(1, 1)),
				nn.BatchNorm2d(64),
				nn.ReLU(),
				nn.Conv2d(64,64,(3, 3),(1, 1),(1, 1)),
				nn.BatchNorm2d(64),
				nn.ReLU(),
				nn.Conv2d(64,128,(1, 1)),
			),
			nn.Sequential( # Sequential,
				nn.Conv2d(64,128,(1, 1)),
			),
		),
		LambdaReduce(lambda x,y: x+y), # CAddTable,
	),
	nn.MaxPool2d((2, 2),(2, 2)),
	nn.Sequential( # Sequential,
		LambdaMap(lambda x: x, # ConcatTable,
			nn.Sequential( # Sequential,
				nn.BatchNorm2d(128),
				nn.ReLU(),
				nn.Conv2d(128,64,(1, 1)),
				nn.BatchNorm2d(64),
				nn.ReLU(),
				nn.Conv2d(64,64,(3, 3),(1, 1),(1, 1)),
				nn.BatchNorm2d(64),
				nn.ReLU(),
				nn.Conv2d(64,128,(1, 1)),
			),
			Lambda(lambda x: x), # Identity,
		),
		LambdaReduce(lambda x,y: x+y), # CAddTable,
	),
	nn.Sequential( # Sequential,
		LambdaMap(lambda x: x, # ConcatTable,
			nn.Sequential( # Sequential,
				nn.BatchNorm2d(128),
				nn.ReLU(),
				nn.Conv2d(128,128,(1, 1)),
				nn.BatchNorm2d(128),
				nn.ReLU(),
				nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
				nn.BatchNorm2d(128),
				nn.ReLU(),
				nn.Conv2d(128,256,(1, 1)),
			),
			nn.Sequential( # Sequential,
				nn.Conv2d(128,256,(1, 1)),
			),
		),
		LambdaReduce(lambda x,y: x+y), # CAddTable,
	),
	LambdaMap(lambda x: x, # ConcatTable,
		Lambda(lambda x: x), # Identity,
		nn.Sequential( # Sequential,
			LambdaMap(lambda x: x, # ConcatTable,
				nn.Sequential( # Sequential,
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
													),
													nn.Sequential( # Sequential,
														nn.MaxPool2d((2, 2),(2, 2)),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Upsample(scale_factor=2, mode='nearest'),
													),
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
												nn.Sequential( # Sequential,
													LambdaMap(lambda x: x, # ConcatTable,
														nn.Sequential( # Sequential,
															nn.BatchNorm2d(256),
															nn.ReLU(),
															nn.Conv2d(256,128,(1, 1)),
															nn.BatchNorm2d(128),
															nn.ReLU(),
															nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
															nn.BatchNorm2d(128),
															nn.ReLU(),
															nn.Conv2d(128,256,(1, 1)),
														),
														Lambda(lambda x: x), # Identity,
													),
													LambdaReduce(lambda x,y: x+y), # CAddTable,
												),
											),
										),
										nn.Sequential( # Sequential,
											nn.MaxPool2d((2, 2),(2, 2)),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Upsample(scale_factor=2, mode='nearest'),
										),
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
									nn.Sequential( # Sequential,
										LambdaMap(lambda x: x, # ConcatTable,
											nn.Sequential( # Sequential,
												nn.BatchNorm2d(256),
												nn.ReLU(),
												nn.Conv2d(256,128,(1, 1)),
												nn.BatchNorm2d(128),
												nn.ReLU(),
												nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
												nn.BatchNorm2d(128),
												nn.ReLU(),
												nn.Conv2d(128,256,(1, 1)),
											),
											Lambda(lambda x: x), # Identity,
										),
										LambdaReduce(lambda x,y: x+y), # CAddTable,
									),
								),
							),
							nn.Sequential( # Sequential,
								nn.MaxPool2d((2, 2),(2, 2)),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Upsample(scale_factor=2, mode='nearest'),
							),
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
						nn.Sequential( # Sequential,
							LambdaMap(lambda x: x, # ConcatTable,
								nn.Sequential( # Sequential,
									nn.BatchNorm2d(256),
									nn.ReLU(),
									nn.Conv2d(256,128,(1, 1)),
									nn.BatchNorm2d(128),
									nn.ReLU(),
									nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
									nn.BatchNorm2d(128),
									nn.ReLU(),
									nn.Conv2d(128,256,(1, 1)),
								),
								Lambda(lambda x: x), # Identity,
							),
							LambdaReduce(lambda x,y: x+y), # CAddTable,
						),
					),
				),
				nn.Sequential( # Sequential,
					nn.MaxPool2d((2, 2),(2, 2)),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Upsample(scale_factor=2, mode='nearest'),
				),
			),
			LambdaReduce(lambda x,y: x+y), # CAddTable,
			nn.Sequential( # Sequential,
				LambdaMap(lambda x: x, # ConcatTable,
					nn.Sequential( # Sequential,
						nn.BatchNorm2d(256),
						nn.ReLU(),
						nn.Conv2d(256,128,(1, 1)),
						nn.BatchNorm2d(128),
						nn.ReLU(),
						nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
						nn.BatchNorm2d(128),
						nn.ReLU(),
						nn.Conv2d(128,256,(1, 1)),
					),
					Lambda(lambda x: x), # Identity,
				),
				LambdaReduce(lambda x,y: x+y), # CAddTable,
			),
			nn.Sequential( # Sequential,
				nn.Conv2d(256,256,(1, 1)),
				nn.BatchNorm2d(256),
				nn.ReLU(),
			),
			nn.Sequential( # Sequential,
				nn.Conv2d(256,256,(1, 1)),
				nn.BatchNorm2d(256),
				nn.ReLU(),
			),
		),
	),
	LambdaReduce(lambda x,y: x+y), # CAddTable,
	LambdaMap(lambda x: x, # ConcatTable,
		Lambda(lambda x: x), # Identity,
		nn.Sequential( # Sequential,
			LambdaMap(lambda x: x, # ConcatTable,
				nn.Sequential( # Sequential,
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
													),
													nn.Sequential( # Sequential,
														nn.MaxPool2d((2, 2),(2, 2)),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Sequential( # Sequential,
															LambdaMap(lambda x: x, # ConcatTable,
																nn.Sequential( # Sequential,
																	nn.BatchNorm2d(256),
																	nn.ReLU(),
																	nn.Conv2d(256,128,(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
																	nn.BatchNorm2d(128),
																	nn.ReLU(),
																	nn.Conv2d(128,256,(1, 1)),
																),
																Lambda(lambda x: x), # Identity,
															),
															LambdaReduce(lambda x,y: x+y), # CAddTable,
														),
														nn.Upsample(scale_factor=2, mode='nearest'),
													),
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
												nn.Sequential( # Sequential,
													LambdaMap(lambda x: x, # ConcatTable,
														nn.Sequential( # Sequential,
															nn.BatchNorm2d(256),
															nn.ReLU(),
															nn.Conv2d(256,128,(1, 1)),
															nn.BatchNorm2d(128),
															nn.ReLU(),
															nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
															nn.BatchNorm2d(128),
															nn.ReLU(),
															nn.Conv2d(128,256,(1, 1)),
														),
														Lambda(lambda x: x), # Identity,
													),
													LambdaReduce(lambda x,y: x+y), # CAddTable,
												),
											),
										),
										nn.Sequential( # Sequential,
											nn.MaxPool2d((2, 2),(2, 2)),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Sequential( # Sequential,
												LambdaMap(lambda x: x, # ConcatTable,
													nn.Sequential( # Sequential,
														nn.BatchNorm2d(256),
														nn.ReLU(),
														nn.Conv2d(256,128,(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
														nn.BatchNorm2d(128),
														nn.ReLU(),
														nn.Conv2d(128,256,(1, 1)),
													),
													Lambda(lambda x: x), # Identity,
												),
												LambdaReduce(lambda x,y: x+y), # CAddTable,
											),
											nn.Upsample(scale_factor=2, mode='nearest'),
										),
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
									nn.Sequential( # Sequential,
										LambdaMap(lambda x: x, # ConcatTable,
											nn.Sequential( # Sequential,
												nn.BatchNorm2d(256),
												nn.ReLU(),
												nn.Conv2d(256,128,(1, 1)),
												nn.BatchNorm2d(128),
												nn.ReLU(),
												nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
												nn.BatchNorm2d(128),
												nn.ReLU(),
												nn.Conv2d(128,256,(1, 1)),
											),
											Lambda(lambda x: x), # Identity,
										),
										LambdaReduce(lambda x,y: x+y), # CAddTable,
									),
								),
							),
							nn.Sequential( # Sequential,
								nn.MaxPool2d((2, 2),(2, 2)),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Sequential( # Sequential,
									LambdaMap(lambda x: x, # ConcatTable,
										nn.Sequential( # Sequential,
											nn.BatchNorm2d(256),
											nn.ReLU(),
											nn.Conv2d(256,128,(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
											nn.BatchNorm2d(128),
											nn.ReLU(),
											nn.Conv2d(128,256,(1, 1)),
										),
										Lambda(lambda x: x), # Identity,
									),
									LambdaReduce(lambda x,y: x+y), # CAddTable,
								),
								nn.Upsample(scale_factor=2, mode='nearest'),
							),
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
						nn.Sequential( # Sequential,
							LambdaMap(lambda x: x, # ConcatTable,
								nn.Sequential( # Sequential,
									nn.BatchNorm2d(256),
									nn.ReLU(),
									nn.Conv2d(256,128,(1, 1)),
									nn.BatchNorm2d(128),
									nn.ReLU(),
									nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
									nn.BatchNorm2d(128),
									nn.ReLU(),
									nn.Conv2d(128,256,(1, 1)),
								),
								Lambda(lambda x: x), # Identity,
							),
							LambdaReduce(lambda x,y: x+y), # CAddTable,
						),
					),
				),
				nn.Sequential( # Sequential,
					nn.MaxPool2d((2, 2),(2, 2)),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Sequential( # Sequential,
						LambdaMap(lambda x: x, # ConcatTable,
							nn.Sequential( # Sequential,
								nn.BatchNorm2d(256),
								nn.ReLU(),
								nn.Conv2d(256,128,(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
								nn.BatchNorm2d(128),
								nn.ReLU(),
								nn.Conv2d(128,256,(1, 1)),
							),
							Lambda(lambda x: x), # Identity,
						),
						LambdaReduce(lambda x,y: x+y), # CAddTable,
					),
					nn.Upsample(scale_factor=2, mode='nearest'),
				),
			),
			LambdaReduce(lambda x,y: x+y), # CAddTable,
			nn.Sequential( # Sequential,
				LambdaMap(lambda x: x, # ConcatTable,
					nn.Sequential( # Sequential,
						nn.BatchNorm2d(256),
						nn.ReLU(),
						nn.Conv2d(256,128,(1, 1)),
						nn.BatchNorm2d(128),
						nn.ReLU(),
						nn.Conv2d(128,128,(3, 3),(1, 1),(1, 1)),
						nn.BatchNorm2d(128),
						nn.ReLU(),
						nn.Conv2d(128,256,(1, 1)),
					),
					Lambda(lambda x: x), # Identity,
				),
				LambdaReduce(lambda x,y: x+y), # CAddTable,
			),
			nn.Sequential( # Sequential,
				nn.Conv2d(256,256,(1, 1)),
				nn.BatchNorm2d(256),
				nn.ReLU(),
			),
			nn.Sequential( # Sequential,
				nn.Conv2d(256,256,(1, 1)),
				nn.BatchNorm2d(256),
				nn.ReLU(),
			),
		),
	),
	LambdaReduce(lambda x,y: x+y), # CAddTable,
	LambdaMap(lambda x: x, # ConcatTable,
		nn.Sequential( # Sequential,
			nn.Sequential( # Sequential,
				nn.Conv2d(256,256,(1, 1)),
				nn.BatchNorm2d(256),
				nn.ReLU(),
			),
			nn.Conv2d(256,200,(1, 1)),
			nn.Upsample(scale_factor=4, mode='bilinear'),
			nn.Sigmoid(),
		),
	),
)
