awslabs / keras-apache-mxnet

[DEPRECATED] Amazon Deep Learning's Keras with Apache MXNet support
https://github.com/awslabs/keras-apache-mxnet/wiki
Other
290 stars 65 forks source link

Disable test_multi_hot_sparse_categorical_crossentropy in Tensorflow backend #180

Closed kalyc closed 5 years ago

kalyc commented 5 years ago

Disable test_multi_hot_sparse_categorical_crossentropy for tensorflow backend -

__ test_multi_hot_sparse_categorical_crossentropy ___ [gw1] darwin -- Python 3.4.5 /anaconda2/envs/mxnet/bin/python

def test_multi_hot_sparse_categorical_crossentropy():
    y_true_np = np.array([[0, 1, 1], [1, 0, 1], [1, 0, 0]])
    y_pred_np = np.array([[0.1, 0.4, 0.5],
                          [0.4, 0.2, 0.4],
                          [0.7, 0.2, 0.1]])
    y_true_np2 = np.array([[1, 2], [0, 2], [0]])
    loss = K.eval(losses.categorical_crossentropy(K.variable(y_true_np), K.variable(y_pred_np)))

    # pad labels to have the same size, use -1 to differentiate from normal class labels
    y_true_np2 = keras.preprocessing.sequence.pad_sequences(y_true_np2, value=-1)
    y_pred2 = K.variable(y_pred_np)
    y_true2 = K.variable(y_true_np2)
  loss2 = K.eval(losses.multi_hot_sparse_categorical_crossentropy(y_true2, y_pred2))

tests/keras/losses_test.py:124:


y_true = <tf.Variable 'Variable_30:0' shape=(3, 2) dtype=float32_ref>, y_pred = <tf.Variable 'Variable_29:0' shape=(3, 3) dtype=float32_ref>

def multi_hot_sparse_categorical_crossentropy(y_true, y_pred):
    if K.backend() != 'mxnet':
      raise NotImplementedError('multi_hot_sparse_categorical_crossentropy '

'is only available in MXNet backend') E NotImplementedError: multi_hot_sparse_categorical_crossentropy is only available in MXNet backend