Skip to content

[DOCS] wp.array auto-conversion using wp.array() #624

@JonathanKuelz

Description

@JonathanKuelz

Category

  • Report an error in the documentation.
  • Request for something to be documented.
  • Suggestion to improve the documentation.
  • Other: Warning / error message

Description

The documentation recommends constructing warp arrays from torch (I guess the same holds for numpy) using from_torch. However, it is also possible to do the following:

a = torch.arange(10)
wp1 = wp.array(a, dtype=wp.int32)
wp2 = wp.array(a, dtype=wp.int64)

While this does not seem to be recommended anywhere, I suggest raising a warning or even an error if this is done and it triggers a data type conversion.

The above example will result in:

wp1 -> [0 0 1 0 2 0 3 0 4 0]
wp2 -> [0 1 2 3 4 5 6 7 8 9]

without any warning, which can lead to hard-to-detect bugs.

Sub-issues

Metadata

Metadata

Assignees

Labels

docsImprovements or additions to documentationinteropInteroperability of Warp with other libraries

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions