I've configured the environment I need: tf1.8 and python3.6,when I ran the examples/SiO2/generate_NNP/run.py or examples/SiO2/error_check/run.py,I found this ValueError: "Cannot convert a partially known TensorShape to a Tensor: %s" % s) ValueError: Cannot convert a partially known TensorShape to a Tensor: (?,).
This error traceback: tf.unsorted_segment_mean(self.e_loss, self.next_elem['struct_ind'], tf.size(self.next_elem['struct_type_set'])).
examples/SiO2/generate_NNP/run.py
Traceback (most recent call last):
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1757, in ones
tensor_shape.TensorShape(shape))
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 256, in _tensor_shape_tensor_conversion_function
"Cannot convert a partially known TensorShape to a Tensor: %s" % s)
ValueError: Cannot convert a partially known TensorShape to a Tensor: (?,)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "run.py", line 6, in
model.run()
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/simple_nn-20.2-py3.6-linux-x86_64.egg/simple_nn/init.py", line 197, in run
self.model.train(user_optimizer=user_optimizer, aw_modifier=modifier)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/simple_nn-20.2-py3.6-linux-x86_64.egg/simple_nn/models/neural_network.py", line 745, in train
self._get_loss()
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/simple_nn-20.2-py3.6-linux-x86_64.egg/simple_nn/models/neural_network.py", line 337, in _get_loss
self.str_e_loss = tf.unsorted_segment_mean(self.e_loss, self.next_elem['struct_ind'], tf.size(self.next_elem['struct_type_set']))
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 2656, in unsorted_segment_mean
N = _unsorted_segment_N(data, segment_ids, num_segments)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 2620, in _unsorted_segment_N
ones_tensor = array_ops.ones(segment_ids.shape, dtype=data.dtype)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1760, in ones
shape = ops.convert_to_tensor(shape, dtype=dtypes.int32)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1014, in convert_to_tensor
as_ref=False)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1104, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 256, in _tensor_shape_tensor_conversion_function
"Cannot convert a partially known TensorShape to a Tensor: %s" % s)
ValueError: Cannot convert a partially known TensorShape to a Tensor: (?,)
Then, I print ```self.next_elem```,```self.next_elem['struct_type_set']```and ```tf.size(self.next_elem['struct_type_set']) ```
Traceback (most recent call last):
File "run.py", line 6, in
model.run()
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/simple_nn-20.2-py3.6-linux-x86_64.egg/simple_nn/init.py", line 197, in run
self.model.train(user_optimizer=user_optimizer, aw_modifier=modifier)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/simple_nn-20.2-py3.6-linux-x86_64.egg/simple_nn/models/neural_network.py", line 745, in train
self._get_loss()
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/simple_nn-20.2-py3.6-linux-x86_64.egg/simple_nn/models/neural_network.py", line 337, in _get_loss
self.str_e_loss = tf.unsorted_segment_mean(self.e_loss, self.next_elem['struct_ind'], tf.size(self.next_elem['struct_type_set']))
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 2656, in unsorted_segment_mean
N = _unsorted_segment_N(data, segment_ids, num_segments)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 2620, in _unsorted_segment_N
ones_tensor = array_ops.ones(segment_ids.shape, dtype=data.dtype)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1760, in ones
shape = ops.convert_to_tensor(shape, dtype=dtypes.int32)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1014, in convert_to_tensor
as_ref=False)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1104, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 256, in _tensor_shape_tensor_conversion_function
"Cannot convert a partially known TensorShape to a Tensor: %s" % s)
ValueError: Cannot convert a partially known TensorShape to a Tensor: (?,)
How can I solve this error?
I've configured the environment I need: tf1.8 and python3.6,when I ran the
examples/SiO2/generate_NNP/run.py
orexamples/SiO2/error_check/run.py
,I found thisValueError
:"Cannot convert a partially known TensorShape to a Tensor: %s" % s) ValueError: Cannot convert a partially known TensorShape to a Tensor: (?,)
.This error traceback:
tf.unsorted_segment_mean(self.e_loss, self.next_elem['struct_ind'], tf.size(self.next_elem['struct_type_set']))
.examples/SiO2/generate_NNP/run.py
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "run.py", line 6, in
model.run()
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/simple_nn-20.2-py3.6-linux-x86_64.egg/simple_nn/init.py", line 197, in run
self.model.train(user_optimizer=user_optimizer, aw_modifier=modifier)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/simple_nn-20.2-py3.6-linux-x86_64.egg/simple_nn/models/neural_network.py", line 745, in train
self._get_loss()
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/simple_nn-20.2-py3.6-linux-x86_64.egg/simple_nn/models/neural_network.py", line 337, in _get_loss
self.str_e_loss = tf.unsorted_segment_mean(self.e_loss, self.next_elem['struct_ind'], tf.size(self.next_elem['struct_type_set']))
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 2656, in unsorted_segment_mean
N = _unsorted_segment_N(data, segment_ids, num_segments)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 2620, in _unsorted_segment_N
ones_tensor = array_ops.ones(segment_ids.shape, dtype=data.dtype)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1760, in ones
shape = ops.convert_to_tensor(shape, dtype=dtypes.int32)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1014, in convert_to_tensor
as_ref=False)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1104, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 256, in _tensor_shape_tensor_conversion_function
"Cannot convert a partially known TensorShape to a Tensor: %s" % s)
ValueError: Cannot convert a partially known TensorShape to a Tensor: (?,)
self.next_elem = {'E': <tf.Tensor 'IteratorGetNext:0' shape=(?, ?) dtype=float64>, 'tot_num': <tf.Tensor 'IteratorGetNext:13' shape=(?, ?) dtype=float64>, 'partition': <tf.Tensor 'Reshape:0' shape=(?,) dtype=int32>, 'struct_type': <tf.Tensor 'IteratorGetNext:11' shape=(?, ?) dtype=string>, 'struct_weight': <tf.Tensor 'IteratorGetNext:12' shape=(?, ?) dtype=float64>, 'pickle_name': <tf.Tensor 'IteratorGetNext:10' shape=(?, ?) dtype=string>, 'atom_idx': <tf.Tensor 'DynamicPartition_2:1' shape=(?, 1) dtype=int32>, 'N_Si': <tf.Tensor 'IteratorGetNext:3' shape=(?, ?) dtype=int64>, 'x_Si': <tf.Tensor 'truediv:0' shape=(?, 70) dtype=float64>, 'dx_Si': <tf.Tensor 'truediv_1:0' shape=(?, 70, ?, ?) dtype=float64>, 'partition_Si': <tf.Tensor 'cond/Merge:0' shape=(?,) dtype=int32>, 'N_O': <tf.Tensor 'IteratorGetNext:2' shape=(?, ?) dtype=int64>, 'x_O': <tf.Tensor 'truediv_2:0' shape=(?, 70) dtype=float64>, 'dx_O': <tf.Tensor 'truediv_3:0' shape=(?, 70, ?, ?) dtype=float64>, 'partition_O': <tf.Tensor 'cond_6/Merge:0' shape=(?,) dtype=int32>, 'F': <tf.Tensor 'DynamicPartition_1:1' shape=(?, 3) dtype=float64>, 'num_seg': <tf.Tensor 'add_1:0' shape=() dtype=int32>, 'sparseindices': <tf.Tensor 'Cast_1:0' shape=(?,) dtype=int32>, 'segid': <tf.Tensor 'DynamicPartition:1' shape=(?,) dtype=int32>, 'struct_type_set': <tf.Tensor 'UniqueWithCounts_1:0' shape=(?,) dtype=string>, 'struct_ind': <tf.Tensor 'UniqueWithCounts_1:1' shape=(?,) dtype=int32>, 'struct_N': <tf.Tensor 'UniqueWithCounts_1:2' shape=(?,) dtype=int32>, 'seg_id_Si': <tf.Tensor 'cond_4/Merge:0' shape=(?,) dtype=int32>, 'sparse_indices_Si': <tf.Tensor 'Cast_2:0' shape=(?,) dtype=int32>, 'seg_id_O': <tf.Tensor 'cond_10/Merge:0' shape=(?,) dtype=int32>, 'sparse_indices_O': <tf.Tensor 'Cast_3:0' shape=(?,) dtype=int32>}
self.next_elem['struct_type_set'] = Tensor("UniqueWithCounts_1:0", shape=(?,), dtype=string)
tf.size(self.next_elem['struct_type_set']) = Tensor("Size:0", shape=(), dtype=int32)
Traceback (most recent call last): File "run.py", line 6, in
model.run()
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/simple_nn-20.2-py3.6-linux-x86_64.egg/simple_nn/init.py", line 197, in run
self.model.train(user_optimizer=user_optimizer, aw_modifier=modifier)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/simple_nn-20.2-py3.6-linux-x86_64.egg/simple_nn/models/neural_network.py", line 745, in train
self._get_loss()
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/simple_nn-20.2-py3.6-linux-x86_64.egg/simple_nn/models/neural_network.py", line 337, in _get_loss
self.str_e_loss = tf.unsorted_segment_mean(self.e_loss, self.next_elem['struct_ind'], tf.size(self.next_elem['struct_type_set']))
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 2656, in unsorted_segment_mean
N = _unsorted_segment_N(data, segment_ids, num_segments)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 2620, in _unsorted_segment_N
ones_tensor = array_ops.ones(segment_ids.shape, dtype=data.dtype)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1760, in ones
shape = ops.convert_to_tensor(shape, dtype=dtypes.int32)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1014, in convert_to_tensor
as_ref=False)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1104, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/home/hjchen/anaconda3/envs/tf1.8/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 256, in _tensor_shape_tensor_conversion_function
"Cannot convert a partially known TensorShape to a Tensor: %s" % s)
ValueError: Cannot convert a partially known TensorShape to a Tensor: (?,)