|
|
|
@ -68,7 +68,7 @@ class RCNetCentered_3x3(nn.Module):
|
|
|
|
|
window_size = self.stage.rc_conv.window_size
|
|
|
|
|
rc_conv_luts = lut.transfer_rc_conv(self.stage.rc_conv, quantization_interval=quantization_interval).reshape(window_size,window_size,-1)
|
|
|
|
|
dense_conv_lut = lut.transfer_2x2_input_SxS_output(self.stage.dense_conv_block, quantization_interval=quantization_interval, batch_size=batch_size)
|
|
|
|
|
lut_model = rclut.RCLutCentered_3x3.init_from_lut(rc_conv_luts, dense_conv_lut)
|
|
|
|
|
lut_model = rclut.RCLutCentered_3x3.init_from_numpy(rc_conv_luts, dense_conv_lut)
|
|
|
|
|
return lut_model
|
|
|
|
|
|
|
|
|
|
class RCNetCentered_7x7(nn.Module):
|
|
|
|
@ -91,7 +91,7 @@ class RCNetCentered_7x7(nn.Module):
|
|
|
|
|
window_size = self.stage.rc_conv.window_size
|
|
|
|
|
rc_conv_luts = lut.transfer_rc_conv(self.stage.rc_conv, quantization_interval=quantization_interval).reshape(window_size,window_size,-1)
|
|
|
|
|
dense_conv_lut = lut.transfer_2x2_input_SxS_output(self.stage.dense_conv_block, quantization_interval=quantization_interval, batch_size=batch_size)
|
|
|
|
|
lut_model = rclut.RCLutCentered_7x7.init_from_lut(rc_conv_luts, dense_conv_lut)
|
|
|
|
|
lut_model = rclut.RCLutCentered_7x7.init_from_numpy(rc_conv_luts, dense_conv_lut)
|
|
|
|
|
return lut_model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -149,7 +149,7 @@ class RCNetRot90_3x3(nn.Module):
|
|
|
|
|
window_size = self.stage.rc_conv.window_size
|
|
|
|
|
rc_conv_luts = lut.transfer_rc_conv(self.stage.rc_conv, quantization_interval=quantization_interval).reshape(window_size,window_size,-1)
|
|
|
|
|
dense_conv_lut = lut.transfer_2x2_input_SxS_output(self.stage.dense_conv_block, quantization_interval=quantization_interval, batch_size=batch_size)
|
|
|
|
|
lut_model = rclut.RCLutRot90_3x3.init_from_lut(rc_conv_luts, dense_conv_lut)
|
|
|
|
|
lut_model = rclut.RCLutRot90_3x3.init_from_numpy(rc_conv_luts, dense_conv_lut)
|
|
|
|
|
return lut_model
|
|
|
|
|
|
|
|
|
|
def forward(self, x):
|
|
|
|
@ -177,7 +177,7 @@ class RCNetRot90_7x7(nn.Module):
|
|
|
|
|
window_size = self.stage.rc_conv.window_size
|
|
|
|
|
rc_conv_luts = lut.transfer_rc_conv(self.stage.rc_conv, quantization_interval=quantization_interval).reshape(window_size,window_size,-1)
|
|
|
|
|
dense_conv_lut = lut.transfer_2x2_input_SxS_output(self.stage.dense_conv_block, quantization_interval=quantization_interval, batch_size=batch_size)
|
|
|
|
|
lut_model = rclut.RCLutRot90_7x7.init_from_lut(rc_conv_luts, dense_conv_lut)
|
|
|
|
|
lut_model = rclut.RCLutRot90_7x7.init_from_numpy(rc_conv_luts, dense_conv_lut)
|
|
|
|
|
return lut_model
|
|
|
|
|
|
|
|
|
|
def forward(self, x):
|
|
|
|
@ -212,7 +212,7 @@ class RCNetx1(nn.Module):
|
|
|
|
|
rc_conv_luts_7x7 = lut.transfer_rc_conv(self.stage1_7x7.rc_conv, quantization_interval=quantization_interval).reshape(7,7,-1)
|
|
|
|
|
dense_conv_lut_7x7 = lut.transfer_2x2_input_SxS_output(self.stage1_7x7.dense_conv_block, quantization_interval=quantization_interval, batch_size=batch_size)
|
|
|
|
|
|
|
|
|
|
lut_model = rclut.RCLutx1.init_from_lut(
|
|
|
|
|
lut_model = rclut.RCLutx1.init_from_numpy(
|
|
|
|
|
rc_conv_luts_3x3=rc_conv_luts_3x3, dense_conv_lut_3x3=dense_conv_lut_3x3,
|
|
|
|
|
rc_conv_luts_5x5=rc_conv_luts_5x5, dense_conv_lut_5x5=dense_conv_lut_5x5,
|
|
|
|
|
rc_conv_luts_7x7=rc_conv_luts_7x7, dense_conv_lut_7x7=dense_conv_lut_7x7
|
|
|
|
@ -265,7 +265,7 @@ class RCNetx2(nn.Module):
|
|
|
|
|
s2_rc_conv_luts_7x7 = lut.transfer_rc_conv(self.stage2_7x7.rc_conv, quantization_interval=quantization_interval).reshape(7,7,-1)
|
|
|
|
|
s2_dense_conv_lut_7x7 = lut.transfer_2x2_input_SxS_output(self.stage2_7x7.dense_conv_block, quantization_interval=quantization_interval, batch_size=batch_size)
|
|
|
|
|
|
|
|
|
|
lut_model = rclut.RCLutx2.init_from_lut(
|
|
|
|
|
lut_model = rclut.RCLutx2.init_from_numpy(
|
|
|
|
|
s1_rc_conv_luts_3x3=s1_rc_conv_luts_3x3, s1_dense_conv_lut_3x3=s1_dense_conv_lut_3x3,
|
|
|
|
|
s1_rc_conv_luts_5x5=s1_rc_conv_luts_5x5, s1_dense_conv_lut_5x5=s1_dense_conv_lut_5x5,
|
|
|
|
|
s1_rc_conv_luts_7x7=s1_rc_conv_luts_7x7, s1_dense_conv_lut_7x7=s1_dense_conv_lut_7x7,
|
|
|
|
@ -327,7 +327,7 @@ class RCNetx2Centered(nn.Module):
|
|
|
|
|
s2_rc_conv_luts_7x7 = lut.transfer_rc_conv(self.stage2_7x7.rc_conv, quantization_interval=quantization_interval).reshape(7,7,-1)
|
|
|
|
|
s2_dense_conv_lut_7x7 = lut.transfer_2x2_input_SxS_output(self.stage2_7x7.dense_conv_block, quantization_interval=quantization_interval, batch_size=batch_size)
|
|
|
|
|
|
|
|
|
|
lut_model = rclut.RCLutx2Centered.init_from_lut(
|
|
|
|
|
lut_model = rclut.RCLutx2Centered.init_from_numpy(
|
|
|
|
|
s1_rc_conv_luts_3x3=s1_rc_conv_luts_3x3, s1_dense_conv_lut_3x3=s1_dense_conv_lut_3x3,
|
|
|
|
|
s1_rc_conv_luts_5x5=s1_rc_conv_luts_5x5, s1_dense_conv_lut_5x5=s1_dense_conv_lut_5x5,
|
|
|
|
|
s1_rc_conv_luts_7x7=s1_rc_conv_luts_7x7, s1_dense_conv_lut_7x7=s1_dense_conv_lut_7x7,
|
|
|
|
@ -430,7 +430,7 @@ class RCNetx2Unlutable(nn.Module):
|
|
|
|
|
s2_rc_conv_luts_7x7 = lut.transfer_rc_conv(self.stage2_7x7.rc_conv, quantization_interval=quantization_interval).reshape(7,7,-1)
|
|
|
|
|
s2_dense_conv_lut_7x7 = lut.transfer_2x2_input_SxS_output(self.stage2_7x7.dense_conv_block, quantization_interval=quantization_interval, batch_size=batch_size)
|
|
|
|
|
|
|
|
|
|
lut_model = rclut.RCLutx2.init_from_lut(
|
|
|
|
|
lut_model = rclut.RCLutx2.init_from_numpy(
|
|
|
|
|
s1_rc_conv_luts_3x3=s1_rc_conv_luts_3x3, s1_dense_conv_lut_3x3=s1_dense_conv_lut_3x3,
|
|
|
|
|
s1_rc_conv_luts_5x5=s1_rc_conv_luts_5x5, s1_dense_conv_lut_5x5=s1_dense_conv_lut_5x5,
|
|
|
|
|
s1_rc_conv_luts_7x7=s1_rc_conv_luts_7x7, s1_dense_conv_lut_7x7=s1_dense_conv_lut_7x7,
|
|
|
|
@ -535,7 +535,7 @@ class RCNetx2CenteredUnlutable(nn.Module):
|
|
|
|
|
s2_rc_conv_luts_7x7 = lut.transfer_rc_conv(self.stage2_7x7.rc_conv, quantization_interval=quantization_interval).reshape(7,7,-1)
|
|
|
|
|
s2_dense_conv_lut_7x7 = lut.transfer_2x2_input_SxS_output(self.stage2_7x7.dense_conv_block, quantization_interval=quantization_interval, batch_size=batch_size)
|
|
|
|
|
|
|
|
|
|
lut_model = rclut.RCLutx2Centered.init_from_lut(
|
|
|
|
|
lut_model = rclut.RCLutx2Centered.init_from_numpy(
|
|
|
|
|
s1_rc_conv_luts_3x3=s1_rc_conv_luts_3x3, s1_dense_conv_lut_3x3=s1_dense_conv_lut_3x3,
|
|
|
|
|
s1_rc_conv_luts_5x5=s1_rc_conv_luts_5x5, s1_dense_conv_lut_5x5=s1_dense_conv_lut_5x5,
|
|
|
|
|
s1_rc_conv_luts_7x7=s1_rc_conv_luts_7x7, s1_dense_conv_lut_7x7=s1_dense_conv_lut_7x7,
|
|
|
|
|