#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: cc
"""
tensorflow中采用softmax分类mnist
"""
# 1) 载入数据
# 从目录:/home/cc/tensorflow/lib/python2.7/site-packages/ ... \
# tensorflow/examples/tutorials/mnist 导入input_data.py
# download dataset到当前目录下
# one_hot=1, 例如将标量数据1转化未[1,0,0,0,0,0,0,0,0,0]
# from tensorflow/contrib/learn/python/learn/datasets/mnist import read_data_sets
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
# mnist是一个类,类里面继续调用tran,test子类
# 2) 启动tensorflow interactiveSession
import tensorflow as tf
sess = tf.InteractiveSession()
# '''
# a = tf.constant(5.0)
# b = tf.constant(6.0)
# c = a * b
# with tf.Session():
# # We can also use 'c.eval()' here.
# print(c.eval())
# '''
#
# # 3) 计算图 computation graph///placeholders
#
x = tf.placeholde
tensorflow下运行softmax和CNN实例
最新推荐文章于 2022-06-16 19:40:22 发布