日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

tensorflow函数总结

發布時間:2025/5/22 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 tensorflow函数总结 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

數值乘法mul

例如:a=3,b=3,a*b = 9

import tensorflow as tf a = tf.placeholder(tf.float32) b = tf.placeholder(tf.float32) y = tf.mul(a, b) sess = tf.Session() print (sess.run(y, feed_dict={a: 3, b: 3}))
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

結果:9.0

數值和add

例如: a = 3, b=3 ,a+b = 6

import tensorflow as tf a = tf.placeholder(tf.float32) b = tf.placeholder(tf.float32) y = tf.add(a, b) sess = tf.Session() print (sess.run(y, feed_dict={a: 3, b: 3}))
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

結果:6.0

數值減法sub

例如:a=3,b=3,a-b = 0

import tensorflow as tf a = tf.placeholder(tf.float32) b = tf.placeholder(tf.float32) y = tf.sub(a, b) sess = tf.Session() print (sess.run(y, feed_dict={a: 3, b: 3}))
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

結果: 0.0

數值除法div

例如: a=3,b=3,a/b = 1.0

import tensorflow as tf a = tf.placeholder(tf.float32) b = tf.placeholder(tf.float32) y = tf.div(a, b) sess = tf.Session() print (sess.run(y, feed_dict={a: 3, b: 3}))
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

結果: 1.0

數值取模mod

例如:a=3,b=3,a mod b = 0

import tensorflow as tf a = tf.placeholder(tf.float32) b = tf.placeholder(tf.float32) y = tf.mod(a, b) sess = tf.Session() print (sess.run(y, feed_dict={a: 3, b: 3}))
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

結果: 0.0

數值絕對值abs

例如:a=-3, abs (a) = 3

import tensorflow as tf a = tf.placeholder(tf.float32) b = tf.placeholder(tf.float32) y = tf.abs(a) sess = tf.Session() print (sess.run(y, feed_dict={a: -3}))
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

結果: 3.0

數值非負值neg

例如:a=-3, neg (a) = 3

import tensorflow as tf a = tf.placeholder(tf.float32) y = tf.neg(a) sess = tf.Session() print (sess.run(y, feed_dict={a: -3}))
  • 1
  • 2
  • 3
  • 4
  • 5

結果: 3.0

數值符號函數sign

例如:a=-3, neg (a) = 3

import tensorflow as tf a = tf.placeholder(tf.float32) y = tf.neg(a) sess = tf.Session() print (sess.run(y, feed_dict={a: -3}))
  • 1
  • 2
  • 3
  • 4
  • 5

結果: 3.0

數值符號函數sign

例如: a=-3,sign(a) = -1

import tensorflow as tf a = tf.placeholder(tf.float32) y = tf.sign(a) sess = tf.Session() print (sess.run(y, feed_dict={a: -3}))
  • 1
  • 2
  • 3
  • 4
  • 5

結果: -1.0

數值倒數inv

例如: a=-3,sign(a) = -1

import tensorflow as tf a = tf.placeholder(tf.float32) y = tf.sign(a) sess = tf.Session() print (sess.run(y, feed_dict={a: -3}))
  • 1
  • 2
  • 3
  • 4
  • 5

結果: -1.0

數值平方square

例如: a=-3,square(a) = 9

import tensorflow as tf a = tf.placeholder(tf.float32) y = tf.square(a) sess = tf.Session() print (sess.run(y, feed_dict={a: -3}))
  • 1
  • 2
  • 3
  • 4
  • 5

結果: 9.0

數值最近的整數round

例如: a=-3.6,round(a) = -4.0

import tensorflow as tf y = tf.round(a) sess = tf.Session() print (sess.run(y, feed_dict={a: -3.6}))
  • 1
  • 2
  • 3
  • 4

結果: -4.0

例如: a=-3.3,round(a) = -3.0

import tensorflow as tf y = tf.round(a) sess = tf.Session() print (sess.run(y, feed_dict={a: -3.3}))
  • 1
  • 2
  • 3
  • 4

結果:-3.0

數值平方根sqrt

例如: a=4,sqrt(a) = 2

import tensorflow as tf a = tf.placeholder(tf.float32) y = tf.sqrt(a) sess = tf.Session() print (sess.run(y, feed_dict={a: 4}))
  • 1
  • 2
  • 3
  • 4
  • 5

結果: 2.0

數值冪次pow

例如: a=2,b=3,pow(a,b) = 8

import tensorflow as tf a = tf.placeholder(tf.float64) b = tf.placeholder(tf.float64) y = tf.pow(a, b) sess = tf.Session() print (sess.run(y, feed_dict={a: 2, b: 3}))
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

結果: 8.0

數值最近的整數exp

例如: a=2,exp(a) = 7.38906

import tensorflow as tf a = tf.placeholder(tf.float32) y = tf.exp(a) sess = tf.Session() print (sess.run(y, feed_dict={a: 2}))
  • 1
  • 2
  • 3
  • 4
  • 5

結果: 7.38906

數值取對數log

例如: a=-3.6,round(a) = -4.0

import tensorflow as tf a = tf.placeholder(tf.float32) y = tf.log(a) sess = tf.Session() print (sess.run(y, feed_dict={a: 2}))
  • 1
  • 2
  • 3
  • 4
  • 5

結果: 0.69314718056

數值取最大值maximum

例如: a=-3.6, b = 2,maximum(a,b)=2

import tensorflow as tf a = tf.placeholder(tf.float32) b = tf.placeholder(tf.float32) y = tf.maximum(a,b) sess = tf.Session() print (sess.run(y, feed_dict={a: -3.6,b: 2}))
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

結果: 2.0

數值最小值minimum

例如: a=2,b=3minimum(a) = 3

import tensorflow as tf a = tf.placeholder(tf.float64) b = tf.placeholder(tf.float64) y = tf.minimum(a, b) sess = tf.Session() print (sess.run(y, feed_dict={a: 2, b: 3}))
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

結果: 2.0

數值余弦函數cos

例如: a=2,cos(a) = -0.416146836547

import tensorflow as tf a = tf.placeholder(tf.float64) y = tf.cos(a) sess = tf.Session() print (sess.run(y, feed_dict={a: 2}))
  • 1
  • 2
  • 3
  • 4
  • 5

結果: -0.416146836547

數值正弦函數sin

例如: a=2,sin(a) = -0.416146836547

import tensorflow as tf a = tf.placeholder(tf.float64) y = tf.sin(a) sess = tf.Session() print (sess.run(y, feed_dict={a: 2}))
  • 1
  • 2
  • 3
  • 4
  • 5

結果: 0.909297426826

總結

以上是生活随笔為你收集整理的tensorflow函数总结的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。