malmaud/TensorFlow.jl

'Truncate' not in Op when computing the gradients

Closed this issue · 2 comments

I wanted to use fft in tensorflow so I imported the operator using import_op

fft = import_op("FFT")
complex_abs = import_op("ComplexAbs")

I followed the tensorflow implementation tensorflow/tensorflow#2255 (comment)

x = constant(LinRange{Float32}(0.0,1.0,100))
z = complex(x,x)
loss = reduce_sum(complex_abs(fft(z)))
gradients(loss, x)

But I got

ERROR: Tensorflow error: Status: NodeDef mentions attr 'Truncate' not in Op<name=Cast; signature=x:SrcT -> y:DstT; attr=SrcT:type; attr=DstT:type>; NodeDef: gradients/FFT_11_grad/Cast = Cast[DstT=DT_COMPLEX64, SrcT=DT_INT32, Truncate=false](gradients/FFT_11_grad/Prod). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).

I used Julia 1.0.2,
tf_version(kind=:backend) = 1.10.0
tf_version(kind=:python) = 1.12.0
tf_version(kind=:julia) = 0.10.2+

@malmaud I think we just need to regenerate
either generated Ops,
or the ProtoBufs.

Can you do this?

Oh, this actually comes from

tf_version(kind=:backend) = 1.10.0
tf_version(kind=:python) = 1.12.0

Update everything to and it will be solved.