eaplatanios / tensorflow_scala

TensorFlow API for the Scala Programming Language
http://platanios.org/tensorflow_scala/
Apache License 2.0
937 stars 95 forks source link

tf.summary.image throws InvalidArgumentException #45

Closed carlo-veezoo closed 6 years ago

carlo-veezoo commented 6 years ago

Hi Anthony,

I've found another bug when using tf.summary.image. Every time I want to use the function, an InvalidArgumentException is thrown:

Exception in thread "main" org.platanios.tensorflow.jni.InvalidArgumentException: More Input() calls than the 2 input_args while building NodeDef 'image' using Op<name=ImageSummary; signature=tag:string, tensor:T -> summary:string; attr=max_images:int,default=3,min=1; attr=T:type,default=DT_FLOAT,allowed=[DT_UINT8, DT_FLOAT, DT_HALF, DT_DOUBLE]; attr=bad_color:tensor,default=Tensor<type: uint8 shape: [4] values: 255 0 0...>>

I think the binding to the native op might be wrong. Anyways, the following code reproduces the bug for me:

import org.platanios.tensorflow.api._

object ImageSummaryBugReproducer {
  def main(args: Array[String]): Unit = {
    val a = tf.reshape(1, Shape(1,1,1,1))
    tf.summary.image("image", a)
  }
}

Thanks, Carlo

eaplatanios commented 6 years ago

@csaladin94 Thanks a lot for also finding this! :) There was indeed a bug and I fixed it in the last commit. This fix will also be included in the artifacts I will release tomorrow.

carlo-veezoo commented 6 years ago

@eaplatanios Thanks for the fast fix! Really appreciate your responsiveness.

eaplatanios commented 6 years ago

@csaladin94 No problem. Thank you for finding out bugs fast. :)