zoukankan      html  css  js  c++  java
  • TensorFlow 之创建交互式 TensorFlow 会话

    使用变量必须先初始化,增加一个`初始化` op 到图中. init_op = tf.initialize_all_variables()

    1 import tensorflow as tf
    2 sess = tf.InteractiveSession()
    3 x = tf.Variable(4)
    4 a = tf.constant(3)
    5 # 使用初始化器 initializer op 的 run() 方法初始化 'x'
    6 x.initializer.run()
    7 # 增加一个减法 multiply op, 从 'x' 乘 'a'. 运行减法 op, 输出结果
    8 y= tf.multiply(x, a)
    9 print(y.eval())
  • 相关阅读:
    2021/4/6
    2021/4/5
    2021/4/2
    2021/4/1
    2021/3/31
    2021/3/30
    2021/3/29重构
    总结
    js 座机正则
    uni-app 条件编译
  • 原文地址:https://www.cnblogs.com/hsy1941/p/11751778.html
Copyright © 2011-2022 走看看