Paddle
Paddle copied to clipboard
在Python中如何将一个list转换为lod_level=2的LoDTensor
在LoDTensor的design文档中,提到了2-level LoDTensor。但我不清楚如何在代码中将一个list转化为2 level LoDTensor。文档链接:https://github.com/PaddlePaddle/Paddle/blob/8370fa82789bc4f05a3239700681818b0ff224ae/paddle/fluid/framework/lod_tensor.md#recursive-sequences
请以文档中提到的 2-level LoDTensor为例告诉我如何生成一个2-level LoD Tensor 的lod信息。
Let check another example of a 2-level LoD Tensor. Consider a mini-batch of three articles with 3, 1, and 2 sentences, and each sentence consists of a variable number of words:
3 1 2
3 2 4 1 2 3
||| || |||| | || |||