codecamp

TensorFlow函数:IndexedSlices

函数:tf.IndexedSlices

IndexedSlices 类

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

参见指南:变量>稀疏变量更新

在给定索引上的一组张量切片的稀疏表示.
此类是一对张量对象的简单包装:

  • values:具有形状 [D0, D1, ..., Dn] 的任何类型的张量.
  • indices:具有形状 [D0] 的一维整数张量.

IndexedSlices 通常用于表示较大张量形状为 [LARGE0, D1,.., DN] 的子集,其中 LARGE0 >> D0.指数中的值是从较大张量中提取的切片的第一个维度中的索引.

由 IndexedSlices 切片表示的稠密张量有:

dense[slices.indices[i], :, :, :, ...] = slices.values[i, :, :, :, ...]

IndexedSlices 类主要用于具有稀疏渐变 (如 tf.gather) 的操作的渐变定义.

将此表示与 tf.SparseTensor 进行对比,它使用多维指数和标量值.

属性

  • dense_shape
    包含相应稠密张量的形状的1维张量.
  • device
    将在其上生成值的设备的名称,或 None.
  • dtype
    此张量中元素的 DType.
  • graph
    包含值、索引和形状张量的图.
  • indices
    包含切片的索引的1维张量.
  • name
    该 IndexedSlices 的名字.
  • op
    将值作为输出生成的操作.
  • values
    包含切片值的张量.

方法

__init__

__init__(
    values,
    indices,
    dense_shape=None
)

创建一个 IndexedSlices.

__neg__

__neg__()
TensorFlow图形处理函数:tf.import_graph_def
tf.invert_permutation:张量的逆置换
温馨提示
下载编程狮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; }