码迷,mamicode.com
首页 > 其他好文 > 详细

tensorflow-abs

时间:2018-12-07 21:10:17      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:pre   ant   eva   odi   author   keras   code   usr   session   

#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Aug 27 11:16:32 2018 @author: myhaspl """ # TensorFlow and tf.keras import tensorflow as tf sess=tf.Session() with sess: x = tf.constant([[-2.25 + 4.75j], [-3.25 + 5.75j]]) print x.eval() print tf.abs(x).eval() x=tf.constant([12.22,-32]) print x.eval() print tf.abs(x).eval()

注意:对复数x+yi求绝对值,相当于 sqrt(x^2+y^2)

tensorflow-abs

标签:pre   ant   eva   odi   author   keras   code   usr   session   

原文地址:http://blog.51cto.com/13959448/2327723

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!