carefree0910 / MachineLearning

Machine learning algorithms implemented by pure numpy

Home Page:https://mlblog.carefree0910.me

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

报错如下

christ-280990 opened this issue · comments

我用的是tensorflow2.x版本
这是出现在 _fully_connected_linear中的错误 在初始化权重的时候报错
Traceback (most recent call last):
File "D:\NNs_tensorflow\NNs.py", line 8, in
nn = Basic(model_param_settings={'n_epoch':100}).fit(x,y,snapshot_ratio=0)
File "D:\NNs_tensorflow\Base.py", line 149, in fit
self._build_model()
File "D:\NNs_tensorflow\BasicNN.py", line 44, in _build_model
net = self._fully_connected_linear(net, [current_dimension, n_unit], i)
File "D:\NNs_tensorflow\Base.py", line 101, in _fully_connected_linear
w = Toolbox.init_w(shape, "W{}".format(appendix))
File "D:\NNs_tensorflow\NNUtil.py", line 224, in init_w
return tf.Variable(tf.compat.v1.truncated_normal(shape,stddev=math.sqrt(2/sum(shape))),name=name)
TypeError: unsupported operand type(s) for +: 'int' and 'str'

这个当时是用的相当老的 tf 版本了,2.x 可能是兼容不了了🤣

哈哈好耶!🥳