Created by: kexinzhao
Please check #10735 (closed) for why we are doing this.
To solve the issue above, we have merged a PR #10817 and now there is utility functions here to create LoDTensor.
In this PR, we further enhance create_lod_tensor
API so that user can create LoDTensor from a list of sequences of data as follows:
Use create_lod_tensor(data, lod, place) API to generate LoD Tensor,
where data
is a list of sequences of index numbers, lod
is
the level of detail (lod) info associated with data
.
For example, data = [[10, 2, 3], [2, 3]] means that it contains
two sequences of indexes, of length 3 and 2, respectively.
Correspondingly, lod = [[3, 2]] contains one level of detail info,
indicating that data
consists of two sequences of length 3 and 2.
Using this new option, we also simplify the recommender system book example.