tensorflow / java-models

Models in Java
74 stars 38 forks source link

Updated for 0.2 version #18

Closed zaleslaw closed 4 years ago

zaleslaw commented 4 years ago

It's a draft PR, a few examples works incorrectly.

Operand batchLoss = tf.nn .softmaxCrossEntropyWithLogits(logits, oneHot, -1); - behaviour was changed.

Now it fails with exception

Exception in thread "main" org.tensorflow.exceptions.TFInvalidArgumentException: Dimension must be 2 but is 1 for '{{node SoftmaxCrossEntropyWithLogits/Transpose_1}} = Transpose[T=DT_FLOAT, Tperm=DT_INT64](Add_1, SoftmaxCrossEntropyWithLogits/Concat_1)' with input shapes: [?,10], [1].
    at org.tensorflow.internal.c_api.AbstractTF_Status.throwExceptionIfNotOK(AbstractTF_Status.java:87)
    at org.tensorflow.GraphOperationBuilder.finish(GraphOperationBuilder.java:370)
    at org.tensorflow.GraphOperationBuilder.build(GraphOperationBuilder.java:78)
    at org.tensorflow.GraphOperationBuilder.build(GraphOperationBuilder.java:57)
    at org.tensorflow.op.linalg.Transpose.create(Transpose.java:56)
    at org.tensorflow.op.nn.SoftmaxCrossEntropyWithLogits.moveDimToEnd(SoftmaxCrossEntropyWithLogits.java:211)
    at org.tensorflow.op.nn.SoftmaxCrossEntropyWithLogits.softmaxCrossEntropyWithLogits(SoftmaxCrossEntropyWithLogits.java:104)
    at org.tensorflow.op.NnOps.softmaxCrossEntropyWithLogits(NnOps.java:1873)
    at org.tensorflow.model.examples.cnn.vgg.VGGModel.buildFCLayersAndRegularization(VGGModel.java:163)
    at org.tensorflow.model.examples.cnn.vgg.VGGModel.compile(VGGModel.java:124)
    at org.tensorflow.model.examples.cnn.vgg.VGGModel.<init>(VGGModel.java:76)
    at org.tensorflow.model.examples.cnn.vgg.VGG11OnFashionMNIST.main(VGG11OnFashionMNIST.java:43)
zaleslaw commented 4 years ago

@karllessard Please, review and merge (no radical updates here) (related to #18 issue)