profile
viewpoint

Ask questionsWhy doesn't ```tf.keras.losses.binary_crossentropy``` raise error

x = np.arange(10,dtype=np.float64).reshape(10,1)
#x.shape = (10,1)

y = np.arange(10,dtype=np.float64)
#y.shape = (10,)

tf.keras.losses.binary_crossentropy(y_true=y, y_pred=x)
#this line does't raise error

tf.keras.metrics.BinaryAccuracy()(y_true=y, y_pred=x)
#this line neither

tf.keras.metrics.Precision()(y_true=y, y_pred=x)
#this line raise an error

I think binary_crossentropy and BinaryAccuracy should raise an ValueError like tf.keras.metrics.Precision:

ValueError: Shapes (128, 1) and (128,) are incompatible
tensorflow/tensorflow

Answer questions pavithrasv

This is fixed now in : https://github.com/tensorflow/tensorflow/commit/ba8a0c934147fcf2a879f349677fc11676c73835#diff-1d3c0e76cc08b7d6e2e3a6ab89965a5c

useful!

Related questions

ModuleNotFoundError: No module named 'tensorflow.contrib'
Error occurred when finalizing GeneratorDataset iterator
ModuleNotFoundError: No module named 'tensorflow.contrib'
When importing TensorFlow, error loading Hadoop hot 4
The flag 'log_dir' is defined twice. hot 3
[TF 2.0] Dataset has no attribute 'make_one_shot_iterator' hot 3
Lossy conversion from float32 to uint8. Range [0, 1]. Convert image to uint8 prior to saving to suppress this warning. hot 3
TF2.0 AutoGraph issue hot 3
Error loading tensorflow hot 3
AttributeError: module 'tensorflow' has no attribute 'set_random_seed' hot 3
AttributeError: module 'tensorflow' has no attribute 'Session' hot 3
No tf.lite.experimental.nn.bidirectional_dynamic_rnn ops is finded hot 3
AttributeError: module 'tensorflow' has no attribute 'app' hot 3
Incorrect Error TypeError: padded_batch() missing 1 required positional argument: 'padded_shapes' hot 3
tensorflow2.0 detected 'xla_gpu' , but 'gpu' expected hot 2
Github User Rank List