Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TensorFlowException TF_INVALID_ARGUMENT "No OpKernel was registered to support Op 'Reshape' with these attrs. #78

Open
holdenlee opened this issue Feb 22, 2017 · 2 comments

Comments

@holdenlee
Copy link

I can't get reshape to work. In the tensorflow-mnist example (https://github.com/tensorflow/haskell/blob/master/tensorflow-mnist/app/Main.hs) if I replace

let hiddenZ = (images `TF.matMul` hiddenWeights) `TF.add` hiddenBiases

with

let hiddenZ = ((TF.reshape images (TF.vector [batchSize, numPixels])) `TF.matMul` hiddenWeights) `TF.add` hiddenBiases

(which should have no effect because the shape is the same), I get the following error.

Main: TensorFlowException TF_INVALID_ARGUMENT "No OpKernel was registered to support Op 'Reshape' with these attrs.  Registered devices: [CPU], Registered kernels:\n  device='GPU'; T in [DT_COMPLEX128]; Tshape in [DT_INT32]\n  device='GPU'; T in [DT_COMPLEX64]; Tshape in [DT_INT32]\n  device='GPU'; T in [DT_INT8]; Tshape in [DT_INT32]\n  device='GPU'; T in [DT_UINT8]; Tshape in [DT_INT32]\n  device='GPU'; T in [DT_INT16]; Tshape in [DT_INT32]\n  device='GPU'; T in [DT_UINT16]; Tshape in [DT_INT32]\n  device='GPU'; T in [DT_INT64]; Tshape in [DT_INT32]\n  device='GPU'; T in [DT_DOUBLE]; Tshape in [DT_INT32]\n  device='GPU'; T in [DT_FLOAT]; Tshape in [DT_INT32]\n  device='GPU'; T in [DT_HALF]; Tshape in [DT_INT32]\n  device='CPU'; Tshape in [DT_INT32]\n\n\t [[Node: Reshape_27 = Reshape[T=DT_FLOAT, Tshape=DT_INT64](Placeholder_0:0, Const_26:0)]]"
Process exited with ExitFailure 1: /home/optml/holdenl/tensorflow-haskell/.stack-work/install/x86_64-linux-dkd1ce2ff9c9560b648268df668d177711/lts-6.2/7.10.3/bin/Main
@blackgnezdo
Copy link
Contributor

blackgnezdo commented Feb 22, 2017

Looks like a fallout from using Int64 for dimensions. Apparently Reshape is not implemented for Int64 shapes.

We want: [[Node: Reshape_27 = Reshape[T=DT_FLOAT, Tshape=DT_INT64](Placeholder_0:0, Const_26:0)]]"
Yet the only possible match is: device='CPU'; Tshape in [DT_INT32]

@judah
Copy link
Contributor

judah commented Feb 22, 2017

It looks like the kernel is more restrictive than the op (which allows int32 and int64):
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/kernels/reshape_op.cc#L54
https://github.com/tensorflow/tensorflow/blob/1a0742f6a7a06ff54481385b5c51094b0fef8cf3/tensorflow/core/ops/array_ops.cc#L1555

See discussion here which previously moved this error from runtime to graph construction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants