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

TypeError: Placeholder#value must be a int, not '<class 'webdnn.graph.placeholder.Placeholder'>' #631

Closed
lygstate opened this issue Nov 28, 2017 · 8 comments
Assignees

Comments

@lygstate
Copy link
Contributor

lygstate commented Nov 28, 2017

Using TensorFlow backend.
Here To import all
[convert_keras.py] Generating feedforward graph
2017-11-28 22:22:25.563469: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-11-28 22:22:25.563555: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
Traceback (most recent call last):
  File "./webdnn/bin/convert_keras.py", line 117, in <module>
    main()
  File "./webdnn/bin/convert_keras.py", line 67, in main
    graph = converter.convert(model)
  File "E:\CI-Cor-Ready\ai\face-demo-work\webdnn\webdnn\src\graph_transpiler\webdnn\frontend\keras\converter.py", line 105, in convert
    return self._convert_fallback(model)
  File "E:\CI-Cor-Ready\ai\face-demo-work\webdnn\webdnn\src\graph_transpiler\webdnn\frontend\keras\converter.py", line 115, in _convert_fallback
    v.shape[0].value = self._batch_size
  File "E:\CI-Cor-Ready\ai\face-demo-work\webdnn\webdnn\src\graph_transpiler\webdnn\graph\placeholder.py", line 443, in value
    raise TypeError(f"Placeholder#value must be a int, not '{type(new_v)}'")
TypeError: Placeholder#value must be a int, not '<class 'webdnn.graph.placeholder.Placeholder'>'
@lygstate
Copy link
Contributor Author

    converter = KerasConverter(batch_size=Placeholder(label='N'))

The batch_size still to be un resolved. how to

@Kiikurage Kiikurage self-assigned this Nov 28, 2017
@Kiikurage
Copy link
Member

Sorry. I found that recent update broke convert_keras.py. I'll fix it soon.

@lygstate
Copy link
Contributor Author

@Kiikurage, Thanks a lot, webdnn is a great project.

Kiikurage added a commit that referenced this issue Nov 28, 2017
Kiikurage added a commit that referenced this issue Nov 28, 2017
@Kiikurage
Copy link
Member

I've fixed the problem. Please retry with latest revision.

@lygstate
Copy link
Contributor Author

@Kiikurage thanks, partially works, but new problem arised.
The resnet50 are comes from the example in README.md

E:\CI-Cor-Ready\ai\face-demo-work\webdnn>python ./webdnn/bin/convert_keras.py resnet50.h5 --input_shape "(1,224,224,3)" --out output --backend webgpu,webgl
Using TensorFlow backend.
Here To import all
[convert_keras.py] Generating feedforward graph
2017-11-29 00:57:12.210925: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-11-29 00:57:12.211019: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
Traceback (most recent call last):
  File "./webdnn/bin/convert_keras.py", line 117, in <module>
    main()
  File "./webdnn/bin/convert_keras.py", line 67, in main
    graph = converter.convert(model)
  File "E:\CI-Cor-Ready\ai\face-demo-work\webdnn\webdnn\src\graph_transpiler\webdnn\frontend\keras\converter.py", line 106, in convert
    return self._convert_fallback(model)
  File "E:\CI-Cor-Ready\ai\face-demo-work\webdnn\webdnn\src\graph_transpiler\webdnn\frontend\keras\converter.py", line 120, in _convert_fallback
    self._convert_operator(node.outbound_layer)
  File "E:\CI-Cor-Ready\ai\face-demo-work\webdnn\webdnn\src\graph_transpiler\webdnn\frontend\keras\converter.py", line 153, in _convert_operator
    return super(KerasConverter, self)._convert_operator(k_op)
  File "E:\CI-Cor-Ready\ai\face-demo-work\webdnn\webdnn\src\graph_transpiler\webdnn\frontend\converter.py", line 117, in _convert_operator
    self._handler_map[self.__class__.__name__][operator_key](self, operator)
  File "E:\CI-Cor-Ready\ai\face-demo-work\webdnn\webdnn\src\graph_transpiler\webdnn\frontend\keras\layers\convolutional.py", line 196, in _convert_zero_padding2d
    y, = ZeroPadding2D(None, (top, left))(x)
  File "E:\CI-Cor-Ready\ai\face-demo-work\webdnn\webdnn\src\graph_transpiler\webdnn\graph\operators\zero_padding_2d.py", line 39, in __call__
    return self.exec()
  File "E:\CI-Cor-Ready\ai\face-demo-work\webdnn\webdnn\src\graph_transpiler\webdnn\graph\operators\zero_padding_2d.py", line 45, in exec
    N = x_shape_dict[Axis.N]
  File "E:\CI-Cor-Ready\ai\face-demo-work\webdnn\webdnn\src\graph_transpiler\webdnn\graph\axis.py", line 109, in __getitem__
    index = self._keys.index(item)
ValueError: <Axis N> is not in list

@lygstate
Copy link
Contributor Author

Also, the example are not works
E:\CI-Cor-Ready\ai\face-demo-work\webdnn\webdnn\example\resnet>python convert_resnet_keras.py Using TensorFlow backend. 2017-11-29 01:01:45.520258: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2017-11-29 01:01:45.520385: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. Traceback (most recent call last): File "convert_resnet_keras.py", line 37, in <module> main() File "convert_resnet_keras.py", line 27, in main _, graph = generate_graph() File "convert_resnet_keras.py", line 16, in generate_graph graph = KerasConverter(batch_size=1).convert(model) File "C:\Users\lygstate\AppData\Local\Programs\Python\Python36\lib\site-packages\webdnn-1.1.0-py3.6.egg\webdnn\frontend\keras\converter.py", line 106, in convert return self._convert_fallback(model) File "C:\Users\lygstate\AppData\Local\Programs\Python\Python36\lib\site-packages\webdnn-1.1.0-py3.6.egg\webdnn\frontend\keras\converter.py", line 120, in _convert_fallback self._convert_operator(node.outbound_layer) File "C:\Users\lygstate\AppData\Local\Programs\Python\Python36\lib\site-packages\webdnn-1.1.0-py3.6.egg\webdnn\frontend\keras\converter.py", line 153, in _convert_operator return super(KerasConverter, self)._convert_operator(k_op) File "C:\Users\lygstate\AppData\Local\Programs\Python\Python36\lib\site-packages\webdnn-1.1.0-py3.6.egg\webdnn\frontend\converter.py", line 117, in _convert_operator self._handler_map[self.__class__.__name__][operator_key](self, operator) File "C:\Users\lygstate\AppData\Local\Programs\Python\Python36\lib\site-packages\webdnn-1.1.0-py3.6.egg\webdnn\frontend\keras\layers\convolutional.py", line 196, in _convert_zero_padding2d y, = ZeroPadding2D(None, (top, left))(x) File "C:\Users\lygstate\AppData\Local\Programs\Python\Python36\lib\site-packages\webdnn-1.1.0-py3.6.egg\webdnn\graph\operators\zero_padding_2d.py", line 39, in __call__ return self.exec() File "C:\Users\lygstate\AppData\Local\Programs\Python\Python36\lib\site-packages\webdnn-1.1.0-py3.6.egg\webdnn\graph\operators\zero_padding_2d.py", line 45, in exec N = x_shape_dict[Axis.N] File "C:\Users\lygstate\AppData\Local\Programs\Python\Python36\lib\site-packages\webdnn-1.1.0-py3.6.egg\webdnn\graph\axis.py", line 109, in __getitem__ index = self._keys.index(item) ValueError: <Axis N> is not in list`

@Kiikurage
Copy link
Member

Kiikurage commented Nov 28, 2017

Oh... sorry 😥. Because the last commit was quite small fix, i skipped the test. I'll fix it soon and check it works correctly.

@lygstate
Copy link
Contributor Author

lygstate commented Nov 28, 2017

OK, this issue can be closed. I've verified.

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

2 participants