import numpy as np

from keras import objectives
from keras import backend as K


allobj = [objectives.mean_squared_error, objectives.root_mean_squared_error,
          objectives.mean_absolute_error, objectives.mean_absolute_percentage_error,
          objectives.mean_squared_logarithmic_error, objectives.squared_hinge,
          objectives.hinge, objectives.categorical_crossentropy, objectives.binary_crossentropy, objectives.poisson,
          objectives.cosine_proximity]

def test_objective_shapes_3d():
    y_a = K.variable(np.random.random((5, 6, 7)))
    y_b = K.variable(np.random.random((5, 6, 7)))
    for obj in allobj:
        objective_output = obj(y_a, y_b)
        assert K.eval(objective_output).shape == (5, 6)

def test_objective_shapes_2d():
    y_a = K.variable(np.random.random((6, 7)))
    y_b = K.variable(np.random.random((6, 7)))
    for obj in allobj:
        objective_output = obj(y_a, y_b)
        assert K.eval(objective_output).shape == (6,)

@@ -119,44 +119,8 @@
 ror,
- objectives.root_mean_squared_error,
 %0A   
@@ -153,24 +153,34 @@
 olute_error,
+%0A         
  objectives.
@@ -263,16 +263,26 @@
 c_error,
+%0A         
  objecti
@@ -356,32 +356,42 @@
 al_crossentropy,
+%0A         
  objectives.bina
@@ -406,16 +406,26 @@
 entropy,
+%0A         
  objecti
@@ -477,16 +477,17 @@
 imity%5D%0A%0A
+%0A
 def test
@@ -666,32 +666,32 @@
 = obj(y_a, y_b)%0A
-
         assert K
@@ -731,16 +731,17 @@
 (5, 6)%0A%0A
+%0A
 def test

Fix objective tests