mirror of
https://github.com/wassname/keras-contrib.git
synced 2026-07-19 11:24:38 +08:00
30 lines
713 B
Python
30 lines
713 B
Python
import pytest
|
|
import numpy as np
|
|
|
|
from keras import backend as K
|
|
from keras_contrib import backend as KC
|
|
from keras_contrib import objectives
|
|
|
|
|
|
allobj = []
|
|
|
|
|
|
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,)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
pytest.main([__file__])
|