官方API(需FQ)

中文API


方法 返回值类型 参数 说明
算数运算符
.add() Tensor x, y, name=N 加法(若x,y都为tensor, 数据类型需一致, 以下所有x,y都如此)
.subtract() Tensor 同add 减法
.multiply() Tensor 同add 元素级乘法
.scalar_mul() Tensor scalar, x 标量*tensor
.div() Tensor 同add 除法(结果dtype同x,y)
.divide() Tensor 同add 同Python除法 int8, int16 --> float32  int32, int64 --> float64
.truediv() Tensor 同add 同上
.floordiv() Tensor 同add 结果向下取整, 但结果dtype与输入保持一致
.realdiv() Tensor 同add 貌似仅支持浮点型除法
.truncatediv() Tensor 同add 结果截取整数部分, 貌似仅支持整数除法
.floor_div() Tensor 同add 没发现跟floordiv有什么不同
.truncatemod() Tensor 同add 取余, 跟truncatediv对应的取余
.floormod() Tensor 同add 取余, 跟floordiv对应的取余
.mod() Tensor 同add .floormod别名
.cross() Tensor a, b, name=N sum(a*out) = sum(b*out) = 0
基本数学函数(以下name参数全部省略)
.add_n() Tensor inputs list: [Tensor], 计算列表中所有tensor的加法运算
.abs() Tensor x 求绝对值
.negative() Tensor x 负, -x
.sign() Tensor x 符号, y = -1 if x < 0; 0 if x == 0 or tf.is_nan(x); 1 if x > 0
.reciprocal() Tensor x 倒数, 1/x
.square() Tensor x 平方, x**x
.round() Tensor x 四舍六入, 五取偶
.sqrt() Tensor x 开方, x**0.5
.rsqrt() Tensor x 开方的倒数, 1/x**0.5
.pow() Tensor x, y x**y
.exp() Tensor x e**x
.expm1() Tensor x e**x - 1
.log() Tensor x loge x
.log1p() Tensor x loge (1 + x)
.ceil Tensor x 向上取整
.floor() Tensor x 向下取整
.maximum() Tensor x, y 取x,y中的同位置最大值
.minimum() Tensor x, y 取x,y中的同位置最小值
.cos() Tensor x 余弦
.sin() Tensor x 正弦
.lbeta() Tensor x ???
.tan() Tensor x 正切

python库--tensorflow--数学函数的更多相关文章

  1. Cg(C for Graphic)标准函数库之数学函数与几何函数

    和 C 的标准函数库类似, Cg 提供了一系列内建的标准函数.这些函数用于执行数学上的通用计算或通用算法(纹理映射等),例如,需要求取入射光线的反射光线方向向量可以使用标准函数库中的 reflect ...

  2. python库--tensorflow

    方法 返回值类型 参数 说明 张量    .constant() Tensort 张量 实例t value 创建一个常量tensor dtype=None 输出类型 shape=None 返回tens ...

  3. 吴裕雄 python 神经网络——TensorFlow variables_to_restore函数的使用样例

    import tensorflow as tf v = tf.Variable(0, dtype=tf.float32, name="v") ema = tf.train.Expo ...

  4. 吴裕雄 python 神经网络——TensorFlow 图像处理函数

    import numpy as np import tensorflow as tf import matplotlib.pyplot as plt image_raw_data = tf.gfile ...

  5. Python内置数学函数

    class NumString: def __init__(self, value): self.value = str(value) def __str__(self): return self.v ...

  6. python基础学习之路No.5 数学函数以及操作

    python的基本数学函数 函数 返回值 ( 描述 ) abs(x) 返回数字的绝对值,如abs(-10) 返回 10 ceil(x) 返回数字的上入整数,如math.ceil(4.1) 返回 5 c ...

  7. Python: 复数的数学运算

    写的最新的网络认证方案代码遇到了一个难题,唯一的解决办法就是使用复数空间,需要使用复数来执行一些计算操作. 复数可以用使用函数complex(real, imag) 或者是带有后缀j 的浮点数来指定. ...

  8. 【python游戏编程之旅】第四篇---pygame中加载位图与常用的数学函数。

    本系列博客介绍以python+pygame库进行小游戏的开发.有写的不对之处还望各位海涵. 在上一篇博客中,我们学习了pygame事件与设备轮询.http://www.cnblogs.com/msxh ...

  9. Python 绘制你想要的数学函数图形

    Python 非常热门,但除非工作需要没有刻意去了解更多,直到有个函数图要绘制,想起了它.结果发现,完全用不着明白什么是编程,就可以使用它完成很多数学函数图的绘制. 通过以下两个步骤,就可以进行数学函 ...

随机推荐

  1. 百度地图API开发的快速使用和大量坐标点操作【点聚合,海量点,mapv】

    快速上手 注意:本篇文章代码是基于 百度地图 JavaScript API v3.0 的条件下编写,GL版本可能稍有变化. 地图嘛,很重要的一部分就是坐标经纬度了: 经度: 英文 longitude ...

  2. Linux 中的虚拟网络接口

    独立博客地址:https://ryan4yin.space/posts/linux-virtual-network-interfaces/ 本文用到的字符画工具:vscode-asciiflow2 L ...

  3. WPF MVVM模式下路由事件

    一,路由事件下三种路由策略: 1 冒泡:由事件源向上传递一直到根元素.2直接:只有事件源才有机会响应事件.3隧道:从元素树的根部调用事件处理程序并依次向下深入直到事件源.一般情况下,WPF提供的输入事 ...

  4. mac 软件意外退出

    大概率的原因是软件签名问题. 先安装 xcode xcode-select --install 然后签名 sudo codesign --force --deep --sign - 文件位置(直接将应 ...

  5. jupyter notebook使用python虚拟环境

    jupyter指定环境启动 背景 系统环境中安装有jupyter及相关库,因项目需要,新建了一个torch相关的虚拟环境并安装了对应的内容, 此时,想通过系统中的jupyter启动一个可以应用虚拟环境 ...

  6. mysql使用 分区表使用,常用sql

    mysql使用 分区表使用,常用sql 前言 本文的原文连接是: https://blog.csdn.net/freewebsys/article/details/84839478未经博主允许不得转载 ...

  7. noip32

    T1 暴力很好打,然而我是最后打的,所以只有40pts,其他人都有80pts的说 其实也应该想到的吧 80pts用的 \(set\) ,有个log,所以A不了. 正解: 把 \(set\) 换成 \( ...

  8. CentOS7.6新增或修改SSH端口号的步骤

    1.修改SSH配置文件(注意是sshd_config而不是ssh_config,多了个d) vim /etc/ssh/sshd_config 找到"#Port 22",这一行直接键 ...

  9. C# 线程安全的集合

    参考网址: https://docs.microsoft.com/en-us/dotnet/standard/collections/thread-safe/ Thread-Safe Collecti ...

  10. echatrts 各参数快速了解(+实例)

    实例:https://www.jianshu.com/p/8cac22daca98 参数详解:https://echarts.baidu.com/option.html#title.textStyle ...