python学习中遇到问题

来源:互联网 发布:linux nmon 编辑:程序博客网 时间:2024/04/27 19:07

首先本人python版本为2.7
一、在python 中使用中文时,需要在代码第一行加入#coding=utf-8语句,它就是第一行唯一的一句,不要加其他东西,特别注意该语句之前不要有空格

二、在使用theano包时,会报TypeError: Cannot convert Type TensorType(float64, matrix) (of Variable Subtensor{int64:int64:}.0) into Type TensorType(float32, matrix). You can try to manually convert Subtensor{int64:int64:}.0 into a TensorType(float32, matrix)错误,这个问题折腾了我好久,分析了好多原因都不对,后来发现是本机python的floatX类型跟theano的floatX类型不匹配,我的是float64,而theano的是float32。在import 语句后面加入theano.config.floatX = ‘float32’ 即可(以后还有更新)

1 0
原创粉丝点击