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. leetcode 494. 目标数

    题目描述: 给定一个非负整数数组,a1, a2, ..., an, 和一个目标数,S.现在你有两个符号 + 和 -.对于数组中的任意一个整数,你都可以从 + 或 -中选择一个符号添加在前面. 返回可以 ...

  2. Mybatis的if标签判断空字符串 == 0,参数为0时会自动转为空字符串

    对于这个问题,有两种解决办法. 1.当传入的参数有0时,只判断!=null即可. 2.将0转化为String类型,就可以解决这个问题.

  3. Android Sensor详解(1)简介与架构【转】

    本文转载自:https://blog.csdn.net/u013983194/article/details/53244686 最近在学习有关如何porting sensor的东西,仅借此机会写博客来 ...

  4. Leetcode: Closest Leaf in a Binary Tree

    Given a binary tree where every node has a unique value, and a target key k, find the value of the n ...

  5. FastStone Capture 9.3 强烈推荐,常用功能介绍

    http://www.dayanzai.me/faststone-capture.html   经典优秀屏幕截图录像工具 FastStone Capture 9.3 绿色汉化中文版 下载 官网: ht ...

  6. FilelistCreator --- 导出文件列表神器 及其他好用工具

    https://www.sttmedia.com/ Standard Software WordCreator: Creates readable words, sentences or texts ...

  7. Mac OSX系统中Hadoop / Hive 与 spark 的安装与配置 环境搭建 记录

    Mac OSX系统中Hadoop / Hive 与 spark 的安装与配置 环境搭建 记录     Hadoop 2.6 的安装与配置(伪分布式) 下载并解压缩 配置 .bash_profile : ...

  8. 消息中间件 RabbitMQ 入门篇

    消息中间件 RabbitMQ 入门篇 五月君 K8S中文社区 今天   作者:五月君,来源:Nodejs技术栈 从不浪费时间的人,没有工夫抱怨时间不够.—— 杰弗逊 RabbitMQ 是一套开源(MP ...

  9. C++ Multimap运用实例

    C++ Multimap运用实例 #include <map> #include <string> #include <iostream> #include < ...

  10. LeetCode 559. Maximum Depth of N-ary Tree(N-Tree的深度)

    Given a n-ary tree, find its maximum depth. The maximum depth is the number of nodes along the longe ...