File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -612,6 +612,25 @@ def __truediv__(self, other):
612
612
"""Return ``self/value``."""
613
613
return dpnp .true_divide (self , other )
614
614
615
+ @property
616
+ def __usm_ndarray__ (self ):
617
+ """
618
+ Property to support `__usm_ndarray__` protocol.
619
+
620
+ It assumes to return :class:`dpctl.tensor.usm_ndarray` instance
621
+ corresponding to the content of the object.
622
+
623
+ This property is intended to speed-up conversion from
624
+ :class:`dpnp.ndarray` to :class:`dpctl.tensor.usm_ndarray` passed
625
+ into `dpctl.tensor.asarray` function. The input object that implements
626
+ `__usm_ndarray__` protocol is recognized as owner of USM allocation
627
+ that is managed by a smart pointer, and asynchronous deallocation
628
+ will not involve GIL.
629
+
630
+ """
631
+
632
+ return self ._array_obj
633
+
615
634
def __xor__ (self , other ):
616
635
"""Return ``self^value``."""
617
636
return dpnp .bitwise_xor (self , other )
You can’t perform that action at this time.
0 commit comments