b0VIM 7.4¦ìZâdjtitouantitouan~titouan/WORKSPACE/QCNN/deep_complex_networks/complexnn/utils.py 3210#"! UtpXadúvXêÒÑÏ“’xQPN Þɬ«e=÷ å  ® ˆ t K J I 4 ö Ù Ø ’ j J I $  ï Û µ ¡ x w v f K 0 /   Ù ¯ † g f   ó ò ½ ¼ › š ™ ƒ g C  á˯‹Z)øÙ¨wvu return getpart_output_shape(input_shape) def compute_output_shape(self, input_shape): return get_abs(inputs) def call(self, inputs):class GetAbs(Layer): return getpart_output_shape(input_shape) def compute_output_shape(self, input_shape): return get_imagpart(inputs) def call(self, inputs):class GetImag(Layer): return getpart_output_shape(input_shape) def compute_output_shape(self, input_shape): return get_realpart(inputs) def call(self, inputs):class GetReal(Layer): return tuple(returned_shape) returned_shape[axis] = returned_shape[axis] // 2 axis = -1 else: axis = 1 if (image_format == 'channels_first' and ndim != 3) or ndim == 2: ndim = len(returned_shape) image_format = K.image_data_format() returned_shape = list(input_shape[:])def getpart_output_shape(input_shape): return K.sqrt(real * real + imag * imag) imag = get_imagpart(x) real = get_realpart(x)def get_abs(x): return x[:, :, :, :, input_dim:] elif ndim == 5: return x[:, :, :, input_dim:] elif ndim == 4: return x[:, :, input_dim:] if ndim == 3: input_dim = input_shape[-1] // 2 return x[:, input_dim:] input_dim = input_shape[1] // 2 if (image_format == 'channels_first' and ndim != 3) or ndim == 2: input_shape = K.shape(x) ndim = K.ndim(x) image_format = K.image_data_format()def get_imagpart(x): return x[:, :, :, :, :input_dim] elif ndim == 5: return x[:, :, :, :input_dim] elif ndim == 4: return x[:, :, :input_dim] if ndim == 3: input_dim = input_shape[-1] // 2 return x[:, :input_dim] input_dim = input_shape[1] // 2 if (image_format == 'channels_first' and ndim != 3) or ndim == 2: input_shape = K.shape(x) ndim = K.ndim(x) image_format = K.image_data_format()def get_realpart(x):## GetReal/GetImag Lambda layer Implementation#from keras.layers import Layer, Lambdaimport keras.backend as K# Authors: Dmitriy Serdyuk, Olexa Bilaniuk, Chiheb Trabelsi## -*- coding: utf-8 -*-#!/usr/bin/env python