我是tensorflow的新手,我正在尝试重现网站上发布的实验https://github.com/jiegzhan/image-classification-rnn
我的TensorFlow版本是1.0.1,所以我稍微改变了他的代码.我使用的代码如下.
import os
import sys
import json
import time
import tensorflow as tf
from tensorflow.contrib.rnn.python.ops import rnn, rnn_cell
from tensorflow.examples.tutorials.mnist import input_data
n_input = 28 # MNIST data input (img shape: 28*28)
n_steps = 28 # timesteps
n_hidden = 128 # hidden layer num of features
n_classes = 10 # MNIST total classes (0-9 digits)
#coding:utf-8
def rnn_model(x, weights, biases):
"""RNN (LSTM or GRU) model for image"""
x = tf.transpose(x, [1, 0, 2])
x = tf.reshape(x, [-1, n_input]) …
Run Code Online (Sandbox Code Playgroud)