 def apply_affine(x, y):     # Get dimensions of main tensor     dimens = K.int_shape(x)     # Get numpy array behind main tensor     filter_arr = K.eval(x)     if dimens[0] is not None:         # Go through batch...         for i in range(0, dimens[0]):             # Get the correpsonding affine transformation in the form of a numpy array             affine = K.eval(y)[i, :, :]             # Create an skimage affine transform from the numpy array             transform = AffineTransform(matrix=affine)             # Loop through each filter output from the previous layer of the CNN             for j in range(0, dims[0]):                 # Warp each filter output according to the corresponding affine transform                 warp(filter_arr[i, j, :, :], transform)     # Need to convert filter array back to a keras tensor     return None  transformed_twin = Lambda(function=lambda x: apply_affine(x[0], x[0]))([twin0, transformInput])  