codecamp

TensorFlow函数:tf.sparse_slice

tf.sparse_slice 函数

sparse_slice(
    sp_input,
    start,
    size,
    name=None
)

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

在 tf.sparse_slice 函数中根据 start 和 size 对 SparseTensor 进行切片.

例如,如果输入是为以下的内容:

input_tensor = shape = [2, 7]
[    a   d e  ]
[b c          ]

以图形方式输出张量为:

sparse_slice([0, 0], [2, 4]) = shape = [2, 4]
[    a  ]
[b c    ]

sparse_slice([0, 4], [2, 3]) = shape = [2, 3]
[ d e  ]
[      ]

函数参数:

  • sp_input:表示要分割的 SparseTensor.
  • start:1-D,张量代表分割的开始.
  • size:1-D,张量表示分割的大小.
  • name:操作的名称(可选).

函数返回值:

由拼接产生的 SparseTensor 对象.

可能引发的异常:

  • TypeError:如果 sp_input 不是 SparseTensor,则会引发此异常.
TensorFlow数学函数:tf.sparse_segment_sum
TensorFlow函数:tf.sparse_softmax
温馨提示
下载编程狮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; }