This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Fix + workaround for bug involving Lambda.""" | |
import numpy as np | |
import tensorflow as tf | |
from keras import backend as K | |
from keras.layers import Convolution2D, Lambda | |
from keras.models import Sequential, model_from_json, model_from_yaml | |
def resize_im(x, height_factor, width_factor, dim_ordering): | |
return K.resize_images(x, height_factor, width_factor, dim_ordering) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Small reproduction of bug involving Lambda.""" | |
import tensorflow as tf | |
from keras import backend as K | |
from keras.layers import Convolution2D, Lambda | |
from keras.models import Sequential, model_from_json, model_from_yaml | |
def space_to_depth_output_shape(input_shape): | |
return (input_shape[0], input_shape[1] // 2, input_shape[2] // 2, | |
4 * input_shape[3]) if input_shape[1] else ( |