I'm trying to do this for quite some time now, but couldn't get this to work.
File "/usr/local/lib/python3.4/dist-packages/theano/tensor/basic.py", line 212, in as_tensor_variable
raise AsTensorError("Cannot convert %s to TensorType" % str_x, type(x))
theano.tensor.var.AsTensorError: ('Cannot convert Tensor("pool1/3x3_s2/MaxPool:0", shape=(?, 1, 56, 63), dtype=float32) to TensorType', <class 'tensorflow.python.framework.ops.Tensor'>)
I haven't used tensorflow for so long. Is this issue related to version changes on tensorflow?
Here is the detailed output.
$ python3 dogs_vs_cats_training.py
Using TensorFlow backend.
2017-04-16 16:18:15,717 - __main__ - INFO - Create train and test dataset.
2017-04-16 16:18:16,545 - __main__ - INFO - Shape for X_train: (165, 3, 224, 224) Shape for y_train: (165,)
2017-04-16 16:18:16,545 - __main__ - INFO - Create the model.
/home/teekaram/Desktop/BEATS/tmp/Dogs-vs-Cats/models/google_net.py:15: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(64, (7, 7), kernel_regularizer=<keras.reg..., padding="same", activation="relu", strides=(2, 2), name="conv1/7x7_s2")`
W_regularizer=l2(0.0002))(input)
/home/teekaram/Desktop/BEATS/tmp/Dogs-vs-Cats/models/google_net.py:21: UserWarning: Update your `MaxPooling2D` call to the Keras 2 API: `MaxPooling2D(pool_size=(3, 3), strides=(2, 2), padding="valid", name="pool1/3x3_s2")`
pool1_3x3_s2 = MaxPooling2D(pool_size=(3, 3), strides=(2, 2), border_mode='valid', name='pool1/3x3_s2')(
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/theano/tensor/type.py", line 270, in dtype_specs
}[self.dtype]
KeyError: 'object'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/theano/tensor/basic.py", line 250, in constant_or_value
TensorType(dtype=x_.dtype, broadcastable=bcastable),
File "/usr/local/lib/python3.4/dist-packages/theano/tensor/type.py", line 51, in __init__
self.dtype_specs() # error checking is done there
File "/usr/local/lib/python3.4/dist-packages/theano/tensor/type.py", line 273, in dtype_specs
% (self.__class__.__name__, self.dtype))
TypeError: Unsupported dtype for TensorType: object
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/theano/tensor/basic.py", line 206, in as_tensor_variable
return constant(x, name=name, ndim=ndim)
File "/usr/local/lib/python3.4/dist-packages/theano/tensor/basic.py", line 264, in constant
dtype=dtype)
File "/usr/local/lib/python3.4/dist-packages/theano/tensor/basic.py", line 259, in constant_or_value
raise TypeError("Could not convert %s to TensorType" % x, type(x))
TypeError: ('Could not convert Tensor("pool1/3x3_s2/MaxPool:0", shape=(?, 1, 56, 63), dtype=float32) to TensorType', <class 'tensorflow.python.framework.ops.Tensor'>)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "dogs_vs_cats_training.py", line 88, in <module>
model = modified_googlenet(WIDTH, HEIGHT)
File "/home/teekaram/Desktop/BEATS/tmp/Dogs-vs-Cats/models/google_net.py", line 24, in modified_googlenet
pool1_norm1 = LRN(name='pool1/norm1')(pool1_3x3_s2)
File "/usr/local/lib/python3.4/dist-packages/keras/engine/topology.py", line 578, in __call__
output = self.call(inputs, **kwargs)
File "/home/teekaram/Desktop/BEATS/tmp/Dogs-vs-Cats/googlenet_custom_layers.py", line 16, in call
input_sqr = T.sqr(x) # square the input
File "/usr/local/lib/python3.4/dist-packages/theano/gof/op.py", line 615, in __call__
node = self.make_node(*inputs, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/theano/tensor/elemwise.py", line 576, in make_node
inputs = list(map(as_tensor_variable, inputs))
File "/usr/local/lib/python3.4/dist-packages/theano/tensor/basic.py", line 212, in as_tensor_variable
raise AsTensorError("Cannot convert %s to TensorType" % str_x, type(x))
theano.tensor.var.AsTensorError: ('Cannot convert Tensor("pool1/3x3_s2/MaxPool:0", shape=(?, 1, 56, 63), dtype=float32) to TensorType', <class 'tensorflow.python.framework.ops.Tensor'>)