3、tensorflow变量运算,数学运算
import tensorflow as tf
import numpy as np a = tf.range(1,7)
a = tf.reshape(a,[2,3])
b = tf.constant([[2],[2],[2]])
#b = tf.reshape(b,[1,-1])
c = tf.matmul(a,b)
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
print(sess.run(a))
print(sess.run(b))
print(sess.run(c))
[[1 2 3]
[4 5 6]]
[[2]
[2]
[2]]
[[12]
[30]]
参考:https://blog.csdn.net/mzpmzk/article/details/78636142
1. 加减乘除
2. (x = tf.reshape(x,[-1,1]))
3. tf.matmul(a,b)
4. tf.transpose
5. tf.segment_sum
#m = tf.constant([5,1,7,2,3,4,1,3])
#s_id = [0,0,0,1,2,2,3,3]
#s.run(tf.segment_sum(m, segment_ids=s_id))
6. tf.unique
tf.equal
tf.where
7. tf.argmax
tf.nn.softmax()
tf.nn.top_k #https://blog.csdn.net/mzpmzk/article/details/78636217
3、tensorflow变量运算,数学运算的更多相关文章
- 玩转变量、环境变量以及数学运算(shell)
变量和环境变量 var=value 给变量赋值,输出语句:$ echo $var或者是$ echo ${var},记住中间有个空格 例如:name="coffee" age ...
- linux学习(八)Shell中变量的数学运算
目录 常见的运算符 expr命令 @(Shell中变量的数学运算) 常见的运算符 环境变量 说明 + 加 - 减 * 乘 / 除 % 取模 因为Shell中将*作为通配符使用, expr命令 expr ...
- 【Linux】通过传入变量进行数学运算
一个简单的sum求和 #! /bin/bash ## For get the sum of tow numbers ## Writen by Qinys ## Date:2018-06-26 a=1 ...
- Tensorflow数学运算
一.Tensor 之间的运算规则 1) 相同大小 Tensor 之间的任何算术运算都会将运算应用到元素级 2) 不同大小 Tensor(要求dimension 0 必须相同) 之间的运算叫做广播(br ...
- SHELL脚本--数学运算和bc命令
bash&shell系列文章:http://www.cnblogs.com/f-ck-need-u/p/7048359.html 使用let.(()).$(())或$[]进行基本的整数运算,使 ...
- Linux shell 变量 数学 运算
Abstract : 1) Linux shell 中使用 let , [ ] ,(( )) 三种运算符操作 shell 变量进行简单的基本运算: 2)Linux shell 中使用 expr 与 ...
- shell变量数学运算
shell变量数学运算 #!/bin/sh # 本脚本说明shell脚本中变量运算的用法 # 错误的用法var=1var=$var+1echo $var 输出:1+1 # 第一种用法,letvar=1 ...
- 认真学习shell的第一天-数学运算
shell中的数学运算有三种方式: (1)let,用let的时候,变量名称前不用添加$ (2)[],[]中变量可使用也可不使用$ (3)(())变量名之前必须添加$
- shell中的数学运算
shell中要进行数学运算通常有3中方法: expr命令 比如 expr 1 + 6就会返回7,使用expr的缺点就是碰到乘法运算,或者加括号(因为它们在shell中有其他意义),需要使用转义,比如: ...
- PHP - 数学运算
第4章 数学运算 学习要点: 1.数值数据类型 2.随机数 3.格式化数据 4.数学函数 在大多数程序设计语言中,数值运算都是最基本的元素之一.数值运算允许程序员完成加法到高级计算等各种操作.尽管PH ...
随机推荐
- tp6.0.x 反序列化漏洞
tp6 反序列化漏洞复现 环境 tp6.0 apache php7.3 漏洞分析 反序列化漏洞需要存在 unserialize() 作为触发条件,修改入口文件 app/controller/Index ...
- 小谢第58问:nuxt搭建企业官网
最近公司要重构公司官网,jq+bootstrap 改为了vue,刚开始我以为用vue不是挺好的嘛,后来才发现,有于vue单页面的特性,不利于搜索引擎的抓取,因此在seo方面需要另外想办法,于是乎,就找 ...
- TCP中RTT的测量和RTO的计算
https://blog.csdn.net/zhangskd/article/details/7196707 tcp传输往返时间是指:发送方发送tcp断开时, 到发送方接收到改段立即响应的所耗费的时间 ...
- linux 网络编程 基础
网络编程基础 套接字编程需要指定套接字地址作为参数,不同的协议族有不同的地址结构,比如以太网其结构为sockaddr_in. 通用套接字: struct sockaddr { sa_family_t ...
- Spring源码之循环依赖
https://www.cnblogs.com/longy2012/articles/12834762.html https://www.bilibili.com/video/BV1iD4y1o7pM ...
- linux 更改mysql 数据存储目录
https://www.cnblogs.com/hellangels333/p/8376177.html 参考位博主的文章,稍做改动 1.检查mysql数据库存放目录 mysql -u root - ...
- 解决 Mac webstrom Mac bigsur 中 Can‘t use Subversion command line client:svn
解决 Mac webstrom Can't use Subversion command line client: svn The path to the Subversion executable ...
- git 最新笔记,工作中的必会技能
1.状态查看: git status 可以查看工作区,暂存区的状态 untracked 在暂存区没有该文件 modified 修改过 staged 使用git add 暂存过 2.添加操作: git ...
- Linux学习 - 02 使用 - Centos8 - 『更换rpm/epel包源为国内源』
1. Centos8 - 『更换rpm/epel包源为国内源』 centos 8 默认是会读取centos.org的mirrorlist的,所以一般来说是不需要配置镜像的. 如果你的网络访问mirro ...
- 精益求精!Spring Boot 知识点全面回顾,带你重新细读源码!
约定优于配置 Build Anything with Spring Boot:Spring Boot is the starting point for building all Spring-bas ...