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的运用的更多相关文章

  1. tensorflow 学习笔记-- tf.reduce_max、tf.sequence_mask

    1.tf.reduce_max函数的作用:计算张量的各个维度上的元素的最大值.例子: import tensorflow as tfmax_value = tf.reduce_max([1, 3, 2 ...

  2. tf.reduce_max 与 reduce 系列 API

    reduce 可以理解为 python 里的 reduce 函数: tensorflow 中有很多 reduce_ API,其用法完全相同 tf.reduce_max 以这个为例进行说明 def re ...

  3. tf.reduce_sum()_tf.reduce_mean()_tf.reduce_max()

    根据官方文档: reduce_sum应该理解为压缩求和,用于降维 tf.reduce_sum(input_tensor,axis=None,keepdims=None,name=None,reduct ...

  4. 图融合之加载子图:Tensorflow.contrib.slim与tf.train.Saver之坑

    import tensorflow as tf import tensorflow.contrib.slim as slim import rawpy import numpy as np impor ...

  5. TF常用知识

    命名空间及变量共享 # coding=utf-8 import tensorflow as tf import numpy as np import matplotlib.pyplot as plt; ...

  6. tensorflow中 tf.reduce_mean函数

    tf.reduce_mean 函数用于计算张量tensor沿着指定的数轴(tensor的某一维度)上的的平均值,主要用作降维或者计算tensor(图像)的平均值. reduce_mean(input_ ...

  7. TensorFlow高级API(tf.contrib.learn)及可视化工具TensorBoard的使用

    一.TensorFlow高层次机器学习API (tf.contrib.learn) 1.tf.contrib.learn.datasets.base.load_csv_with_header 加载cs ...

  8. TensorFlow 学习(七) — 常用函数 api、tf.nn 库

    0. 四则运算 平方:tf.square(),开方:tf.sqrt() tf.add().tf.sub().tf.mul().tf.div().tf.mod().tf.abs().tf.neg() 1 ...

  9. 解释张量及TF的一些API

    张量的定义 张量(Tensor)理论是数学的一个分支学科,在力学中有重要应用.张量这一术语起源于力学,它最初是用来表示弹性介质中各点应力状态的,后来张量理论发展成为力学和物理学的一个有力的数学工具.张 ...

随机推荐

  1. 初识RSA

    基础知识:http://www.guideep.com/read?guide=5676830073815040# python实现:https://blog.csdn.net/bian_h_f6127 ...

  2. Linux系统下zookeeper客户端命令使用

    1. 启动客户端 [admin@yrjk bin]$ ./zkCli.sh [zk: localhost:2181(CONNECTED) 0] 2. 显示所有操作命令 [zk: localhost:2 ...

  3. response.redirect 正在中止线程

    问题描述:正在中止线程问题原因:Response.End 方法终止页的执行,并将此执行切换到应用程序的事件管线中的 Application_EndRequest 事件.不执行 Response.End ...

  4. CentOS7 升级 cmake

    编译cmake文件时,报错:CMake 3.0.0 or higher is required. You are running version 2.8.12.2 很明显,这是 cmake 版本过低导 ...

  5. Transaction 那点事儿

    Transaction 那点事儿 https://my.oschina.net/huangyong/blog/160012

  6. scrapy爬虫案例:用MongoDB保存数据

    用Pymongo保存数据 爬取豆瓣电影top250movie.douban.com/top250的电影数据,并保存在MongoDB中. items.py class DoubanspiderItem( ...

  7. Cassandra开发入门文档第一部分

    Cassandra的特点 横向可扩展性: Cassandra部署具有几乎无限的存储和处理数据的能力.当需要额外的容量时,可以简单地将更多的机器添加到集群中.当新机器加入集群时,Cassandra需要对 ...

  8. kerberos相关

    1.kerberos认证覆盖问题 先显示指定KRB5CCNAME存储的路径 export KRB5CCNAME=/tmp/krb5cc_xxx kinit -kt /home/xxx.keytab x ...

  9. 在条件判断中使用 all() / any()

    在条件判断中使用 all() / any() all() 和 any() 两个函数非常适合在条件判断中使用.这两个函数接受一个可迭代对象,返回一个布尔值,其中: all(seq):仅当 seq 中所有 ...

  10. 导出excel按照指定格式

    1.项目有个需求,要按照特定格式 导出Excel表格. 正常的都是一行 ,下面是数据.这次有个变动,就是每隔 几列要换行,下面是数据.在下面是数据部分.花了一上午写了下需求,不难但是花时间 //实现特 ...