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

Model Brute cannot convert to Tensor #37

Open
warrenronsiek opened this issue Mar 11, 2017 · 4 comments
Open

Model Brute cannot convert to Tensor #37

warrenronsiek opened this issue Mar 11, 2017 · 4 comments

Comments

@warrenronsiek
Copy link

Hi, I'm trying to run the sugarskull example with Tensorflow. Everything works as expected except when I specify -model=brute. When I do, I get this error:

Using TensorFlow backend.
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally
Tensorflow detected. Forcing --a-scale-mode=match (A images are scaled to same size as B images)
Using brute-force model
Scale factor 0.25 "A" shape (1, 3, 644, 483) "B" shape (1, 3, 644, 483)
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
W 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.
W 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.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:910] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 0 with properties:
name: Tesla K80
major: 3 minor: 7 memoryClockRate (GHz) 0.8235
pciBusID 0000:00:1e.0
Total memory: 11.17GiB
Free memory: 11.11GiB
I tensorflow/core/common_runtime/gpu/gpu_device.cc:906] DMA: 0
I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 0:   Y
I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tesla K80, pci bus id: 0000:00:1e.0)
Building loss...
Precomputing static features...
Building and combining losses...
Traceback (most recent call last):
  File "/usr/local/bin/make_image_analogy.py", line 27, in <module>
    image_analogy.main.main(args, model_class)
  File "/usr/local/lib/python2.7/dist-packages/image_analogy/main.py", line 71, in main
    model.build(a_image, ap_image, b_image, (1, img_num_channels, img_height, img_width))
  File "/usr/local/lib/python2.7/dist-packages/image_analogy/models/base.py", line 23, in build
    loss = self.build_loss(a_image, ap_image, b_image)
  File "/usr/local/lib/python2.7/dist-packages/image_analogy/models/analogy.py", line 37, in build_loss
    patch_stride=self.args.patch_stride)
  File "/usr/local/lib/python2.7/dist-packages/image_analogy/losses/analogy.py", line 28, in analogy_loss
    best_a_prime_patches = find_analogy_patches(a, a_prime, b, patch_size=patch_size, patch_stride=patch_stride)
  File "/usr/local/lib/python2.7/dist-packages/image_analogy/losses/analogy.py", line 14, in find_analogy_patches
    a_patches, a_patches_norm = patches.make_patches(K.variable(a), patch_size, patch_stride)
  File "/usr/local/lib/python2.7/dist-packages/image_analogy/losses/patches.py", line 14, in make_patches
    mode='valid')
  File "/usr/local/lib/python2.7/dist-packages/theano/tensor/nnet/neighbours.py", line 553, in images2neibs
    return Images2Neibs(mode)(ten4, neib_shape, neib_step)
  File "/usr/local/lib/python2.7/dist-packages/theano/gof/op.py", line 611, in __call__
    node = self.make_node(*inputs, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/theano/tensor/nnet/neighbours.py", line 84, in make_node
    ten4 = T.as_tensor_variable(ten4)
  File "/usr/local/lib/python2.7/dist-packages/theano/tensor/basic.py", line 208, in as_tensor_variable
    raise AsTensorError("Cannot convert %s to TensorType" % str_x, type(x))
theano.tensor.var.AsTensorError: ('Cannot convert Tensor("ExpandDims:0", shape=(1, 256, 161, 120), dtype=float32) to TensorType', <class 'tensorflow.python.framework.ops.Tensor'>)

What is going wrong here?

@getarobo
Copy link

any solve found? help~

@getarobo
Copy link

i have figured out.

  • keras 2.x -> keras 1.1.2
    pip uninstall keras
    pip install keras==1.1.2

  • set keras to use theano instead of tensorflow
    sudo vi ~/.keras/keras.json
    (change backend from tensorflow to theano)

@keshavunni
Copy link

@getarobo But what if I want to use Keras 2.x

@mike-truk
Copy link

@warrenronsiek I ran into the same roadblock. I would love to be able to use tensorflow with model=brute.

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

4 participants