codecamp

TensorFlow直方图

直方图

  • tf.histogram_fixed_width
histogram_fixed_width ( 
    values, 
    VALUE_RANGE,
    nbins = 100,
    dtype = TF.INT32,
    name = none
 )

定义在:tensorflow/python/ops/histogram_ops.py.

参见指南:直方图>直方图

返回值的直方图。

给定张量 values,这个操作返回一个秩为1的直方图,计算 values 落入每个库的条目数。箱子宽度相等,由参数 value_range和nbins。

参数:

  • values:数字Tensor.
  • value_range:形状[2] Tensor的相同dtype的values.值<= value_range [0]将被映射到hist [0],值> = value_range [1]将映射到hist [-1].
  • nbins:标量int32 Tensor.柱状图仓数.
  • dtype:返回直方图的dtype.
  • name:此操作的名称(默认为“histogram_fixed_width”).

返回:

一维D Tensor值保持直方图.

例子:

#Bins will be:(-INF,1),[1,2),[2,3),[3,4),[4,INF) 
nbins =  5 
VALUE_RANGE =  [ 0.0 , 5.0 ] 
new_values =  [ - 1.0 , 0.0 , 1.5 , 2.0 , 5.0 , 15 ]

with tf.default_session () as sess : 
  hist = tf.histogram_fixed_width ( new_values ,value_range ,nbins = 5 ) 
  variables.global_variables_initializer ().run () 
  sess.run( HIST ) = >  [ 2 , 1 , 1 , 0 , 2 ]


TensorFlow 高阶函数
TensorFlow图像操作
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

TensorFlow 函数介绍

TensorFlow 函数模块:tf

TensorFlow的image模块

TensorFlow使用之tf.io

TensorFlow使用之tf.keras

TensorFlow函数教程:tf.keras.applications

TensorFlow函数教程:tf.keras.backend

TensorFlow使用之tf.metrics

TensorFlow使用之tf.nn

TensorFlow使用之tf.python_io

TensorFlow 功能函数

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }