I am trying to run the code using keras 2. I am getting following error:
Traceback (most recent call last):
File "", line 1, in
model = create_model(ortho_reg, neg_size, emb_dim, aspect_size, emb_path, overall_maxlen, vocab)
File "/home/fractaluser/Projects/workspace/UnsupervisedAspectExtraction/code/model.py", line 43, in create_model
r_s = WeightedAspectEmb(aspect_size, emb_dim, name='aspect_emb', W_regularizer=ortho_reg)(p_t)
File "/home/fractaluser/anaconda3/envs/venv_keras/lib/python3.5/site-packages/keras/engine/base_layer.py", line 433, in call
self.build(unpack_singleton(input_shapes))
File "/home/fractaluser/Projects/workspace/UnsupervisedAspectExtraction/code/my_layers.py", line 131, in build
constraint=self.W_constraint)
File "/home/fractaluser/anaconda3/envs/venv_keras/lib/python3.5/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/home/fractaluser/anaconda3/envs/venv_keras/lib/python3.5/site-packages/keras/engine/base_layer.py", line 257, in add_weight
self.add_loss(regularizer(weight))
File "/home/fractaluser/Projects/workspace/UnsupervisedAspectExtraction/code/model.py", line 19, in ortho_reg
return ortho_reg*reg
File "/home/fractaluser/.local/lib/python3.5/site-packages/tensorflow/python/ops/math_ops.py", line 893, in r_binary_op_wrapper
x = ops.convert_to_tensor(x, dtype=y.dtype.base_dtype, name="x")
File "/home/fractaluser/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1050, in convert_to_tensor
as_ref=False)
File "/home/fractaluser/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1146, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/home/fractaluser/.local/lib/python3.5/site-packages/tensorflow/python/framework/constant_op.py", line 229, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/home/fractaluser/.local/lib/python3.5/site-packages/tensorflow/python/framework/constant_op.py", line 208, in constant
value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/home/fractaluser/.local/lib/python3.5/site-packages/tensorflow/python/framework/tensor_util.py", line 442, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/home/fractaluser/.local/lib/python3.5/site-packages/tensorflow/python/framework/tensor_util.py", line 353, in _AssertCompatible
(dtype.name, repr(mismatch), type(mismatch).name))
TypeError: Expected float32, got <function create_model..ortho_reg at 0x7fa3ee0d88c8> of type 'function' instead.
I am trying to run the code using keras 2. I am getting following error:
Traceback (most recent call last):
File "", line 1, in
model = create_model(ortho_reg, neg_size, emb_dim, aspect_size, emb_path, overall_maxlen, vocab)
File "/home/fractaluser/Projects/workspace/UnsupervisedAspectExtraction/code/model.py", line 43, in create_model r_s = WeightedAspectEmb(aspect_size, emb_dim, name='aspect_emb', W_regularizer=ortho_reg)(p_t)
File "/home/fractaluser/anaconda3/envs/venv_keras/lib/python3.5/site-packages/keras/engine/base_layer.py", line 433, in call self.build(unpack_singleton(input_shapes))
File "/home/fractaluser/Projects/workspace/UnsupervisedAspectExtraction/code/my_layers.py", line 131, in build constraint=self.W_constraint)
File "/home/fractaluser/anaconda3/envs/venv_keras/lib/python3.5/site-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(*args, **kwargs)
File "/home/fractaluser/anaconda3/envs/venv_keras/lib/python3.5/site-packages/keras/engine/base_layer.py", line 257, in add_weight self.add_loss(regularizer(weight))
File "/home/fractaluser/Projects/workspace/UnsupervisedAspectExtraction/code/model.py", line 19, in ortho_reg return ortho_reg*reg
File "/home/fractaluser/.local/lib/python3.5/site-packages/tensorflow/python/ops/math_ops.py", line 893, in r_binary_op_wrapper x = ops.convert_to_tensor(x, dtype=y.dtype.base_dtype, name="x")
File "/home/fractaluser/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1050, in convert_to_tensor as_ref=False)
File "/home/fractaluser/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1146, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/home/fractaluser/.local/lib/python3.5/site-packages/tensorflow/python/framework/constant_op.py", line 229, in _constant_tensor_conversion_function return constant(v, dtype=dtype, name=name)
File "/home/fractaluser/.local/lib/python3.5/site-packages/tensorflow/python/framework/constant_op.py", line 208, in constant value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/home/fractaluser/.local/lib/python3.5/site-packages/tensorflow/python/framework/tensor_util.py", line 442, in make_tensor_proto _AssertCompatible(values, dtype)
File "/home/fractaluser/.local/lib/python3.5/site-packages/tensorflow/python/framework/tensor_util.py", line 353, in _AssertCompatible (dtype.name, repr(mismatch), type(mismatch).name))
TypeError: Expected float32, got <function create_model..ortho_reg at 0x7fa3ee0d88c8> of type 'function' instead.