Ejemplo n.º 1
0
 def infer_shape(self, node, input_shape):
     in_shape = input_shape[0]
     c, d = node.inputs[1]
     step_x, step_y = node.inputs[2]
     if self.mode == "wrap_centered":
         grid_c = T.ceil_intdiv(in_shape[2], step_x)
         grid_d = T.ceil_intdiv(in_shape[3], step_y)
     elif self.mode == "valid":
         grid_c = 1 + ((in_shape[2] - c) // step_x)
         grid_d = 1 + ((in_shape[3] - d) // step_y)
     elif self.mode == "ignore_borders":
         grid_c = 1 + ((in_shape[2] - c) // step_x)
         grid_d = 1 + ((in_shape[3] - d) // step_y)
     z_dim0 = grid_c * grid_d * in_shape[1] * in_shape[0]
     z_dim1 = c * d
     return [(z_dim0, z_dim1)]
Ejemplo n.º 2
0
 def infer_shape(self, node, input_shape):
     in_shape = input_shape[0]
     c, d = node.inputs[1]
     step_x, step_y = node.inputs[2]
     if self.mode == 'wrap_centered':
         grid_c = T.ceil_intdiv(in_shape[2], step_x)
         grid_d = T.ceil_intdiv(in_shape[3], step_y)
     elif self.mode == 'valid':
         grid_c = 1 + ((in_shape[2] - c) // step_x)
         grid_d = 1 + ((in_shape[3] - d) // step_y)
     elif self.mode == 'ignore_borders':
         grid_c = 1 + ((in_shape[2] - c) // step_x)
         grid_d = 1 + ((in_shape[3] - d) // step_y)
     z_dim0 = grid_c * grid_d * in_shape[1] * in_shape[0]
     z_dim1 = c * d
     return [(z_dim0, z_dim1)]
Ejemplo n.º 3
0
 def infer_shape(self, node, input_shape):
     in_shape = input_shape[0]
     c, d = node.inputs[1]
     step_x, step_y = node.inputs[2]
     if self.mode == "wrap_centered":
         grid_c = tt.ceil_intdiv(in_shape[2], step_x)
         grid_d = tt.ceil_intdiv(in_shape[3], step_y)
     elif self.mode == "valid":
         grid_c = 1 + ((in_shape[2] - c) // step_x)
         grid_d = 1 + ((in_shape[3] - d) // step_y)
     elif self.mode == "ignore_borders":
         grid_c = 1 + ((in_shape[2] - c) // step_x)
         grid_d = 1 + ((in_shape[3] - d) // step_y)
     elif self.mode == "half":
         grid_c = 1 + ((in_shape[2] - (c % 2)) // step_x)
         grid_d = 1 + ((in_shape[3] - (d % 2)) // step_y)
     elif self.mode == "full":
         grid_c = 1 + ((in_shape[2] + c - 2) // step_x)
         grid_d = 1 + ((in_shape[3] + d - 2) // step_y)
     else:
         raise TypeError(f"Images2Neibs: unknow mode '{self.mode}'")
     z_dim0 = grid_c * grid_d * in_shape[1] * in_shape[0]
     z_dim1 = c * d
     return [(z_dim0, z_dim1)]
Ejemplo n.º 4
0
 def infer_shape(self, node, input_shape):
     in_shape = input_shape[0]
     c, d = node.inputs[1]
     step_x, step_y = node.inputs[2]
     if self.mode == 'wrap_centered':
         grid_c = T.ceil_intdiv(in_shape[2], step_x)
         grid_d = T.ceil_intdiv(in_shape[3], step_y)
     elif self.mode == 'valid':
         grid_c = 1 + ((in_shape[2] - c) // step_x)
         grid_d = 1 + ((in_shape[3] - d) // step_y)
     elif self.mode == 'ignore_borders':
         grid_c = 1 + ((in_shape[2] - c) // step_x)
         grid_d = 1 + ((in_shape[3] - d) // step_y)
     elif self.mode == 'half':
         grid_c = 1 + ((in_shape[2] - (c % 2)) // step_x)
         grid_d = 1 + ((in_shape[3] - (d % 2)) // step_y)
     elif self.mode == 'full':
         grid_c = 1 + ((in_shape[2] + c - 2) // step_x)
         grid_d = 1 + ((in_shape[3] + d - 2) // step_y)
     else:
         raise TypeError("Images2Neibs: unknow mode '%s'" % self.mode)
     z_dim0 = grid_c * grid_d * in_shape[1] * in_shape[0]
     z_dim1 = c * d
     return [(z_dim0, z_dim1)]
Ejemplo n.º 5
0
 def infer_shape(self, node, input_shape):
     in_shape = input_shape[0]
     c, d = node.inputs[1]
     step_x, step_y = node.inputs[2]
     if self.mode == 'wrap_centered':
         grid_c = T.ceil_intdiv(in_shape[2], step_x)
         grid_d = T.ceil_intdiv(in_shape[3], step_y)
     elif self.mode == 'valid':
         grid_c = 1 + ((in_shape[2] - c) // step_x)
         grid_d = 1 + ((in_shape[3] - d) // step_y)
     elif self.mode == 'ignore_borders':
         grid_c = 1 + ((in_shape[2] - c) // step_x)
         grid_d = 1 + ((in_shape[3] - d) // step_y)
     elif self.mode == 'half':
         grid_c = 1 + ((in_shape[2] - (c % 2)) // step_x)
         grid_d = 1 + ((in_shape[3] - (d % 2)) // step_y)
     elif self.mode == 'full':
         grid_c = 1 + ((in_shape[2] + c - 2) // step_x)
         grid_d = 1 + ((in_shape[3] + d - 2) // step_y)
     else:
         raise TypeError("Images2Neibs: unknow mode '%s'" % self.mode)
     z_dim0 = grid_c * grid_d * in_shape[1] * in_shape[0]
     z_dim1 = c * d
     return [(z_dim0, z_dim1)]