tensorflow问题

本文介绍了如何查看TensorFlow的安装版本及路径,并讨论了在使用过程中遇到的两个错误:1. 'Split' Op的输入类型不匹配问题,可能是由于TensorFlow版本差异引起的;2. RNN版本问题。解决方案包括根据API版本调整函数接口参数。
摘要由CSDN通过智能技术生成

一、查看安装的tensorflow版本

python

import tensorflow as tf

tf.__version__

查询tensorflow安装路径为:

tf.__path__

二、报错

1. TypeError: Input 'split_dim' of 'Split' Op has type float32 that does not match expected type of int32.

TensorFlow 版本不同,使用函数接口修改导致的问题。

API r1.3

tf.split

  1. split(  
  2.     value,  
  3.     num_or_size_splits,  
  4.     axis=0,  
  5.     num=None,  
  6.     name='split'  


API r0.12

tf.split

[html]  view plain  copy
  1. tf.split(split_dim, num_split, value, name='split')  

2、rnn版本问题

lstm_cell = rnn_cell.BasicLSTMCell(n_hidden, forget_bias=1.0)
outputs, states = rnn.rnn(lstm_cell, x, dtype=tf.float32)
改为:
outputs, states = tf.contrib.rnn.static_rnn(lstm_cell, x, dtype=tf.float32)
 
(练习:image-classification-rnn-mnist-master, testing acc=0.972)
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值