Skip to content

Commit

Permalink
Use row lengths instead of offsets in convert_df_to_dict (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverholworthy authored Feb 2, 2023
1 parent 2be1fa4 commit 3510a44
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion merlin/systems/triton/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ def _convert_df_to_dict(schema, batch, dtype="int32"):
df_dict[col_name + "__values"] = col.list.leaves.values_host.astype(
col_schema.dtype.to_numpy
)
df_dict[col_name + "__lengths"] = col._column.offsets.values_host.astype(dtype)
offsets = col._column.offsets.values_host.astype(dtype)
row_lengths = offsets[1:] - offsets[:-1]
df_dict[col_name + "__lengths"] = row_lengths
else:
values = col.list.leaves.values_host
values = values.reshape(*shape).astype(col_schema.dtype.to_numpy)
Expand Down

0 comments on commit 3510a44

Please sign in to comment.