前言
本文的文字及图片来源于网络,仅供学习、交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理。
作者:周颖
TypeError: unsupported operand type(s) for ^: 'float' and 'int'
解决办法:把乘方号^改成了**
参考https://stackoverflow.com/questions/34258537/python-typeerror-unsupported-operand-types-for-float-and-int
TypeError: type numpy.ndarray doesn't define __round__ method
解决办法:把round()改成np.round()
TypeError: ufunc 'bitwise_xor' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
解决方法:^改成**
TypeError: only size-1 arrays can be converted to Python scalars
解决办法:把math.exp改成np.exp()
原因:sigma是numpy 的矩阵,要用numpy.exp处理
文章来源: 博客园
- 还没有人评论,欢迎说说您的想法!