zoukankan      html  css  js  c++  java
  • Tensorflow的认识

    1、基本概念(Tensorflow)

    • 使用图(graphs)来表示计算任务 n
    • 在被称之为会话(Session)的上下文(context)中执行图 n
    • 使用tensor表示数据 n
    • 通过变量(Variable)维护状态 n
    • 使用feed和fetch可以为任意的操作赋值或者从其中获取数据

      Tensorflow是一个编程系统,使用图(graphs)来表示计算任务,图(graphs)中的节点称之为op (operation),一个op获得0个或多个Tensor,执行计算,产生0个或多个Tensor。Tensor 看作是 一个 n 维的数组或列表。图必须在会话(Session)里被启动。

    下面是一个简单的TF(tensorflow)程序:

     1 __author__ = "WSX"
     2 import tensorflow as tf
     3 
     4 m1 = tf.constant([[3,3]])   #创建常量OP
     5 m2 = tf.constant([[1],[1]])
     6 product = tf.matmul(m1,m2)  #创建矩阵乘法的OP
     7 
     8 print("product:",product)  #tensor类型
     9 
    10 
    11 #开始定义会话
    12 sess = tf.Session()
    13 result = sess.run(product)
    14 
    15 print("""
    16 result:%s
    17 result_type:%s
    18 """%(result ,type(result)))
    19 sess.close()
    20 
    21 # with tf.Session() as sess:
    22 #     sess.run(product)
  • 相关阅读:
    rabbitmq 学习
    linux下安装rabbitmq 集群
    excel中将时间戳转换为日期格式
    python实现批量修改服务器密码
    python 根据字典的键值进行排序
    python字符串的拼接
    python的变量
    python基础1
    【性能分析】使用Intel VTune Amplifier
    【vim】搜索与替换
  • 原文地址:https://www.cnblogs.com/WSX1994/p/9680094.html
Copyright © 2011-2022 走看看