question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: split() got an unexpected keyword argument 'split_dim'

See original GitHub issue

When trying to run inference.py , I get the following error:

ubuntu@ip-Address:~/tensorflow-deeplab-resnet$ python inference.py --save_dir ./output/ 2718714.jpg deeplab_resnet.ckpt
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcurand.so.8.0 locally
Traceback (most recent call last):
  File "inference.py", line 102, in <module>
    main()
  File "inference.py", line 60, in main
    img_r, img_g, img_b = tf.split(split_dim=2, num_split=3, value=img)
TypeError: split() got an unexpected keyword argument 'split_dim'
ubuntu@ip-Address:~/tensorflow-deeplab-resnet$

I am unsure of how to resolve it.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
ProGamerGovcommented, Feb 10, 2017

Chainging this line:

img = tf.cast(tf.concat(2, [img_b, img_g, img_r]), dtype=tf.float32)

To:

img = tf.cast(tf.concat_v2(2, [img_b, img_g, img_r]), dtype=tf.float32)

Results in:

ubuntu@ip-Address:~/tensorflow-deeplab-resnet$ python inference.py may.jpg deeplab_resnet.ckpt
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcurand.so.8.0 locally
Traceback (most recent call last):
  File "inference.py", line 101, in <module>
    main()
  File "inference.py", line 59, in main
    img = tf.cast(tf.concat_v2(2, [img_b, img_g, img_r]), dtype=tf.float32)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1340, in concat_v2
    dtype=dtypes.int32).get_shape(
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 651, in convert_to_tensor
    as_ref=False)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 716, in internal_convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 176, in _constant_tensor_conversion_function
    return constant(v, dtype=dtype, name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 165, in constant
    tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 367, in make_tensor_proto
    _AssertCompatible(values, dtype)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible
    (dtype.name, repr(mismatch), type(mismatch).__name__))
TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
ubuntu@ip-Address:~/tensorflow-deeplab-resnet$



2reactions
DrSleepcommented, Jan 6, 2017

It seems like you are using the most recent version of TF from github (not yet the released one). According to this list of changes:

tf.split now takes arguments in a reversed order and with different keywords. In particular, we now match NumPy order as tf.split(value, num_or_size_splits, axis).

So to make it work, you would need to change the order from tf.split(split_dim=2, num_split=3, value=img) to tf.split(value=img. num_or_size=3, axis=2 ). Note that it would need to change the provided image reader accordingly (image_reader.py) once you want to use train.py or inference.py

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: split() got an unexpected keyword argument 'expand'
Hi, I'm trying to split a column by space as follows: df.CUSTOMER.str.split(expand=True) here is the error I get: ...
Read more >
split() got an unexpected keyword argument 'expand'
New in version 0.16.1. Based on the old docs it looks like you can do the same thing by specifying the return_type='frame' parameter....
Read more >
Issue 1106694: split() takes no keyword arguments
msg24018 ‑ (view) Author: Vinz (boukthor) Date: 2005‑01‑21 13:30 msg24019 ‑ (view) Author: Bastian Kleineidam (calvin) Date: 2005‑01‑24 12:34 msg24020 ‑ (view) Author: Raymond Hettinger...
Read more >
Error init got an unexpected keyword argument user - Edureka
I am using Django to create a user and an object when the user is created. But there is ... .objects.create(user=instance). How to...
Read more >
load_state_dict() got an unexpected keyword argument 'strict ...
When I try to finetune a model, I set the 'strict' argument to load the state_dict, however, an error appears: “TypeError: load_state_dict() ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found