{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "nibpbUnTsxTd" }, "source": [ "##### Copyright 2018 The TensorFlow Authors." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "cellView": "form", "execution": { "iopub.execute_input": "2022-12-14T22:26:01.622191Z", "iopub.status.busy": "2022-12-14T22:26:01.621704Z", "iopub.status.idle": "2022-12-14T22:26:01.625316Z", "shell.execute_reply": "2022-12-14T22:26:01.624738Z" }, "id": "tXAbWHtqs1Y2" }, "outputs": [], "source": [ "#@title Licensed under the Apache License, Version 2.0 (the \"License\");\n", "# you may not use this file except in compliance with the License.\n", "# You may obtain a copy of the License at\n", "#\n", "# https://www.apache.org/licenses/LICENSE-2.0\n", "#\n", "# Unless required by applicable law or agreed to in writing, software\n", "# distributed under the License is distributed on an \"AS IS\" BASIS,\n", "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n", "# See the License for the specific language governing permissions and\n", "# limitations under the License." ] }, { "cell_type": "markdown", "metadata": { "id": "HTgMAvQq-PU_" }, "source": [ "# 不规则张量\n", "\n", "
![]() | \n",
" ![]() | \n",
" ![]() | \n",
" ![]() | \n",
"
tf.segment_sum
等运算使用的[分段](https://tensorflow.google.cn/api_docs/python/tf/math#about_segmentation)格式相匹配。`row_limits` 方案与 `tf.sequence_mask` 等运算使用的格式相匹配。\n",
"- **均匀维**:如下文所述,`uniform_row_length` 编码用于对具有均匀维的不规则张量进行编码。"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "bpB7xKoUPtU6"
},
"source": [
"### 多个不规则维度\n",
"\n",
"具有多个不规则维度的不规则张量通过为 `values` 张量使用嵌套 `RaggedTensor` 进行编码。每个嵌套 `RaggedTensor` 都会增加一个不规则维度。\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 79,
"metadata": {
"execution": {
"iopub.execute_input": "2022-12-14T22:26:15.309310Z",
"iopub.status.busy": "2022-12-14T22:26:15.308813Z",
"iopub.status.idle": "2022-12-14T22:26:15.321322Z",
"shell.execute_reply": "2022-12-14T22:26:15.320776Z"
},
"id": "yy3IGT2a-PWb"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"