iwyoo / DIRNet-tensorflow

Tensorflow implementation of DIRNet
60 stars 22 forks source link

ValueError: Tried to convert 'input' to a tensor and failed. Error: None values not supported. #13

Open ghost opened 4 years ago

ghost commented 4 years ago

I have tried to apply DIRNet on Brain Haemorrhage Datasets but encountered an error while training .I could resolve the Error: ValueError: Tried to convert 'input' to a tensor and failed. Error: None values not supported.' .Need your recommendation if any .I am using Tensorflow 1.15.2.

ValueError Traceback (most recent call last) /anaconda3/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/op_def_library.py in _apply_op_helper(self, op_type_name, name, **keywords) 527 as_ref=input_arg.is_ref, --> 528 preferred_dtype=default_dtype) 529 except TypeError as err:

/anaconda3/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py in internal_convert_to_tensor(value, dtype, name, as_ref, preferred_dtype, ctx, accepted_result_types) 1296 if ret is None: -> 1297 ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) 1298

/anaconda3/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py in _constant_tensor_conversion_function(v, dtype, name, asref) 285 = as_ref --> 286 return constant(v, dtype=dtype, name=name) 287

/anaconda3/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py in constant(value, dtype, shape, name) 226 return _constant_impl(value, dtype, shape, name, verify_shape=False, --> 227 allow_broadcast=True) 228

/anaconda3/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py in _constant_impl(value, dtype, shape, name, verify_shape, allow_broadcast) 264 value, dtype=dtype, shape=shape, verify_shape=verify_shape, --> 265 allow_broadcast=allow_broadcast)) 266 dtype_value = attr_value_pb2.AttrValue(type=tensor_value.tensor.dtype)

/anaconda3/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/tensor_util.py in make_tensor_proto(values, dtype, shape, verify_shape, allow_broadcast) 436 if values is None: --> 437 raise ValueError("None values not supported.") 438 # if dtype is provided, forces numpy array to be the type

ValueError: None values not supported.

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last) /anaconda3/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/op_def_library.py in _apply_op_helper(self, op_type_name, name, **keywords) 541 observed = ops.internal_convert_to_tensor( --> 542 values, as_ref=input_arg.is_ref).dtype.name 543 except ValueError as err:

/anaconda3/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py in internal_convert_to_tensor(value, dtype, name, as_ref, preferred_dtype, ctx, accepted_result_types) 1296 if ret is None: -> 1297 ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) 1298

/anaconda3/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py in _constant_tensor_conversion_function(v, dtype, name, asref) 285 = as_ref --> 286 return constant(v, dtype=dtype, name=name) 287

/anaconda3/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py in constant(value, dtype, shape, name) 226 return _constant_impl(value, dtype, shape, name, verify_shape=False, --> 227 allow_broadcast=True) 228

/anaconda3/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py in _constant_impl(value, dtype, shape, name, verify_shape, allow_broadcast) 264 value, dtype=dtype, shape=shape, verify_shape=verify_shape, --> 265 allow_broadcast=allow_broadcast)) 266 dtype_value = attr_value_pb2.AttrValue(type=tensor_value.tensor.dtype)

/anaconda3/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/tensor_util.py in make_tensor_proto(values, dtype, shape, verify_shape, allow_broadcast) 436 if values is None: --> 437 raise ValueError("None values not supported.") 438 # if dtype is provided, forces numpy array to be the type

ValueError: None values not supported.

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last)

in 24 25 if __name__ == "__main__": ---> 26 main() in main() 11 mkdir(config.ckpt_dir) 12 ---> 13 reg = DIRNet(sess, config, "DIRNet", is_train=True) 14 dh = MNISTDataHandler("MNIST_data", is_train=True) 15 ~/Documents/DIRNet-tensorflow 4.5.1/models.py in __init__(self, sess, config, name, is_train) 64 65 if self.is_train : ---> 66 self.loss = ncc(self.y, self.z) 67 #self.loss = mse(self.y, self.z) 68 ~/Documents/DIRNet-tensorflow 4.5.1/ops.py in ncc(x, y) 33 def ncc(x, y): 34 mean_x = tf.reduce_mean(x, [1,2,3], keep_dims=True) ---> 35 mean_y = tf.reduce_mean(y, [1,2,3], keep_dims=True) 36 mean_x2 = tf.reduce_mean(tf.square(x), [1,2,3], keep_dims=True) 37 mean_y2 = tf.reduce_mean(tf.square(y), [1,2,3], keep_dims=True) /anaconda3/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/ops/math_ops.py in reduce_mean_v1(input_tensor, axis, keepdims, name, reduction_indices, keep_dims) 1810 keepdims = deprecation.deprecated_argument_lookup("keepdims", keepdims, 1811 "keep_dims", keep_dims) -> 1812 return reduce_mean(input_tensor, axis, keepdims, name) 1813 1814 /anaconda3/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/util/dispatch.py in wrapper(*args, **kwargs) 178 """Call target, and fall back on dispatchers if there is a TypeError.""" 179 try: --> 180 return target(*args, **kwargs) 181 except (TypeError, ValueError): 182 # Note: convert_to_eager_tensor currently raises a ValueError, not a /anaconda3/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/ops/math_ops.py in reduce_mean(input_tensor, axis, keepdims, name) 1868 gen_math_ops.mean( 1869 input_tensor, _ReductionDims(input_tensor, axis), keepdims, -> 1870 name=name)) 1871 1872 /anaconda3/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/ops/gen_math_ops.py in mean(input, axis, keep_dims, name) 6389 _, _, _op = _op_def_lib._apply_op_helper( 6390 "Mean", input=input, reduction_indices=axis, keep_dims=keep_dims, -> 6391 name=name) 6392 _result = _op.outputs[:] 6393 _inputs_flat = _op.inputs /anaconda3/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/op_def_library.py in _apply_op_helper(self, op_type_name, name, **keywords) 544 raise ValueError( 545 "Tried to convert '%s' to a tensor and failed. Error: %s" % --> 546 (input_name, err)) 547 prefix = ("Input '%s' of '%s' Op has type %s that does not match" % 548 (input_name, op_type_name, observed)) ValueError: Tried to convert 'input' to a tensor and failed. Error: None values not supported.