You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is very surprising. Which tensorflow version are you using? I know there's discrepancy between tf.0.12.0 and tf 1.0+. We only tested our code on v0.12.0.
Hi, I have fixed some minor discrepancies between the v0.12.0 and v1.3.0. However, it brings a new error: F tensorflow/core/framework/tensor_shape.cc:243] Check failed: ndims_byte() < MaxDimensions() (unsigned char value 254 vs. 254)Too many dimensions in tensor
Abort trap: 6
In case anyone else runs into this problem, there is an issue with tf.gather(tf.shape(input_), range(ndim-1)) using python 3 because range(ndim-1) cannot be automatically converted to a tensor. Replacing it with list(range(ndim-1)) to explicitly cast it to a list resolves that specific error
def linearND(input_, output_size, scope, init_bias=0.0):
shape = input_.get_shape().as_list()
ndim = len(shape)
#print(ndim)
stddev = min(1.0 / math.sqrt(shape[-1]), 0.1)
with tf.variable_scope(scope):
W = tf.get_variable("Matrix", [shape[-1], output_size], tf.float32, tf.random_normal_initializer(stddev=stddev))
X_shape = tf.gather(tf.shape(input_), range(ndim-1))
target_shape = tf.concat(0, [X_shape, [output_size]])
exp_input = tf.reshape(input_, [-1, shape[-1]])
if init_bias is None:
res = tf.matmul(exp_input, W)
else:
with tf.variable_scope(scope):
b = tf.get_variable("bias", [output_size], initializer=tf.constant_initializer(init_bias))
res = tf.matmul(exp_input, W) + b
res = tf.reshape(res, target_shape)
res.set_shape(shape[:-1] + [output_size])
return res
It seems that the line "X_shape = tf.gather(tf.shape(input_), range(ndim-1))" can't work. Could you help me figure it out?
The text was updated successfully, but these errors were encountered: