tf.reduce_max的运用
a=np.array([[[[1],[2],[3]],[[4],[25],[6]]],[[[27],[8],[99]],[[10],[11],[12]]],[[[13],[14],[15]],[[16],[17],[18]]],[[[14],[24],[15]],[[6],[197],[18]]]])
print(a)
print(a.shape)
b=tf.reduce_max(a, axis=-1)
print(b.shape)
sess=tf.Session()
c=sess.run(b)
print(c)
print(c.shape)
d1=tf.reduce_max(c, axis=-1) # 将[3,2,3]中的第一维度3作为对象,有三个二维的,首先将第一个二维中取,因为2,只能在行中取,最大的作为行
print('if anxies=-1,d1=')
print(sess.run(d1))
d2=tf.reduce_max(c, axis=0)
print('if anxies=0,d2=')
print(sess.run(d2))
d3=tf.reduce_max(c, axis=1)
print('if anxies=1,d3=')
print(sess.run(d3))
d4=tf.reduce_max(c, axis=2)
print('if anxies=2,d4=')
print(sess.run(d4))

tf.reduce_max的运用的更多相关文章
- tensorflow 学习笔记-- tf.reduce_max、tf.sequence_mask
1.tf.reduce_max函数的作用:计算张量的各个维度上的元素的最大值.例子: import tensorflow as tfmax_value = tf.reduce_max([1, 3, 2 ...
- tf.reduce_max 与 reduce 系列 API
reduce 可以理解为 python 里的 reduce 函数: tensorflow 中有很多 reduce_ API,其用法完全相同 tf.reduce_max 以这个为例进行说明 def re ...
- tf.reduce_sum()_tf.reduce_mean()_tf.reduce_max()
根据官方文档: reduce_sum应该理解为压缩求和,用于降维 tf.reduce_sum(input_tensor,axis=None,keepdims=None,name=None,reduct ...
- 图融合之加载子图:Tensorflow.contrib.slim与tf.train.Saver之坑
import tensorflow as tf import tensorflow.contrib.slim as slim import rawpy import numpy as np impor ...
- TF常用知识
命名空间及变量共享 # coding=utf-8 import tensorflow as tf import numpy as np import matplotlib.pyplot as plt; ...
- tensorflow中 tf.reduce_mean函数
tf.reduce_mean 函数用于计算张量tensor沿着指定的数轴(tensor的某一维度)上的的平均值,主要用作降维或者计算tensor(图像)的平均值. reduce_mean(input_ ...
- TensorFlow高级API(tf.contrib.learn)及可视化工具TensorBoard的使用
一.TensorFlow高层次机器学习API (tf.contrib.learn) 1.tf.contrib.learn.datasets.base.load_csv_with_header 加载cs ...
- TensorFlow 学习(七) — 常用函数 api、tf.nn 库
0. 四则运算 平方:tf.square(),开方:tf.sqrt() tf.add().tf.sub().tf.mul().tf.div().tf.mod().tf.abs().tf.neg() 1 ...
- 解释张量及TF的一些API
张量的定义 张量(Tensor)理论是数学的一个分支学科,在力学中有重要应用.张量这一术语起源于力学,它最初是用来表示弹性介质中各点应力状态的,后来张量理论发展成为力学和物理学的一个有力的数学工具.张 ...
随机推荐
- jenkins使用--部署
软件: centos 7.x java jenkins Pipeline ansible 1.安装请看上一文 2.主要是讲部署() 目的:实现 参数化发布 说明 :构建jar包是由gitlab-ci ...
- windows 10环境下安装Tensorflow-gpu
网上有很多教程,特别是简写上的写的都还算比较详细.但我自己还是遇到了几个坑,希望对深度学习有兴趣的同学遇到跟我一样的坑,希望这份记录能帮助到你. 问题一:要不要使用Anaconda? 我看极客时间上的 ...
- 在HPC的节点上使用jupyter notebook
投递任务,注意资源设置 #!/bin/bash #SBATCH --nodes=1 #SBATCH --ntasks=1 #SBATCH --cpus-per-task=1 #SBATCH --mem ...
- 【转发】SqlServer数据库表生成C# Model实体类SQL语句
已知现有表T1 通过运行下面的sql即可,先配置表名. declare @TableName sysname = 'T1' declare @Result varchar(max) = ' /// & ...
- OSS利用ossutil64上传文件
ossutil64下载地址: http://gosspublic.alicdn.com/ossutil/1.6.0/ossutil64?spm=a2c4g.11186623.2.12.3638159 ...
- Spark程序打包
背景: spark程序,使用scala语言开发.整个项目中包含多个子模块,依赖包文件使用maven来管理. 打包: 方法一:使用artifacts来 选择模块,选择对应的主函数: 点ok保存. 由于s ...
- django注释
转自https://www.cnblogs.com/dayouzi/p/10154815.html Django在HTML里面书写的模板语言不能使用这种方法注释,这样注释实际依然有效 <!--{ ...
- what's the psutil模块
what's the psutil模块 psutil 是一个跨平台库,能够轻松实现获取系统运行的进程和系统利用率(包括CPU.内存.磁盘.网络等)信息.它主要用来做系统监控,性能分析,进程管理.它实现 ...
- Spring Boot整合UEditor不修改源码
1.创建Springboot项目,目录结构如下(在resources中static/ueditor/jsp/config.json) 2.pom文件引入 <dependency> < ...
- helm安使用
参照:https://juejin.im/post/5b6590afe51d4519962f02b1