def call(self, inputs, **kwargs): source, target = inputs source_shape = K.shape(source) target_shape = K.shape(target) if K.image_data_format() == 'channels_last': source_height, source_width = source_shape[1:3] target_height, target_width = target_shape[1:3] else: source_height, source_width = source_shape[2:4] target_height, target_width = target_shape[2:4] return K.resize_images(source, target_height / source_height, target_width / source_width, K.image_data_format())
def call(self, inputs): # print("in call") kernel_shape = K.get_value(self.kernel).shape input_shape = K.shape(inputs) output_shape = self.compute_output_shape(input_shape) output_shape = [None]+list(output_shape[1:]) print("output_shape:{}".format(output_shape)) print("kernel_shape:{}".format(kernel_shape)) outputs = K.deconv3d(inputs, self.kernel, output_shape, strides=self.strides, padding=self.padding, data_format=self.data_format, filter_shape=kernel_shape) if self.bias: outputs = K.bias_add( outputs, self.bias, data_format=self.data_format) if self.activation is not None: return self.activation(outputs) return outputs
def int_shape(x): return KC.int_shape(x) if KC.backend() == 'tensorflow' else KC.shape(x)
def __int_shape(self, x): return KC.int_shape(x) if self.backend == 'tensorflow' else KC.shape(x)