fix bug in neural_style_transfer example for image_dim_ordering=tf (#3715)
* fix bug in neural_style_transfer example for image_dim_ordering=tf * fix PEP8 mixed space and tab
This commit is contained in:
parent
cc92025fdc
commit
f5ad1c5753
@ -128,7 +128,10 @@ outputs_dict = dict([(layer.name, layer.output) for layer in model.layers])
|
||||
# the gram matrix of an image tensor (feature-wise outer product)
|
||||
def gram_matrix(x):
|
||||
assert K.ndim(x) == 3
|
||||
features = K.batch_flatten(x)
|
||||
if K.image_dim_ordering() == 'th':
|
||||
features = K.batch_flatten(x)
|
||||
else:
|
||||
features = K.batch_flatten(K.permute_dimensions(x, (2, 0, 1)))
|
||||
gram = K.dot(features, K.transpose(features))
|
||||
return gram
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user