@@ -341,6 +341,107 @@ def __call__(
341341 return out
342342 return dpnp_array ._create_from_usm_ndarray (res_usm )
343343
344+ def outer (
345+ self ,
346+ x1 ,
347+ x2 ,
348+ out = None ,
349+ where = True ,
350+ order = "K" ,
351+ dtype = None ,
352+ subok = True ,
353+ ** kwargs ,
354+ ):
355+ """
356+ Apply the ufunc op to all pairs (a, b) with a in A and b in B.
357+
358+ Parameters
359+ ----------
360+ x1 : {dpnp.ndarray, usm_ndarray}
361+ First input array.
362+ x2 : {dpnp.ndarray, usm_ndarray}
363+ Second input array.
364+ out : {None, dpnp.ndarray, usm_ndarray}, optional
365+ Output array to populate.
366+ Array must have the correct shape and the expected data type.
367+ order : {None, "C", "F", "A", "K"}, optional
368+ Memory layout of the newly output array, Cannot be provided
369+ together with `out`. Default: ``"K"``.
370+ dtype : {None, dtype}, optional
371+ If provided, the destination array will have this dtype. Cannot be
372+ provided together with `out`. Default: ``None``.
373+
374+ Returns
375+ -------
376+ out : dpnp.ndarray
377+ Output array. The data type of the returned array is determined by
378+ the Type Promotion Rules.
379+
380+ Limitations
381+ -----------
382+ Parameters `where` and `subok` are supported with their default values.
383+ Keyword argument `kwargs` is currently unsupported.
384+ Otherwise ``NotImplementedError`` exception will be raised.
385+
386+ See also
387+ --------
388+ :obj:`dpnp.outer` : A less powerful version of dpnp.multiply.outer
389+ that ravels all inputs to 1D. This exists primarily
390+ for compatibility with old code.
391+
392+ :obj:`dpnp.tensordot` : dpnp.tensordot(a, b, axes=((), ())) and
393+ dpnp.multiply.outer(a, b) behave same for all
394+ dimensions of a and b.
395+
396+ Examples
397+ --------
398+ >>> import dpnp as np
399+ >>> A = np.array([1, 2, 3])
400+ >>> B = np.array([4, 5, 6])
401+ >>> np.multiply.outer(A, B)
402+ array([[ 4, 5, 6],
403+ [ 8, 10, 12],
404+ [12, 15, 18]])
405+
406+ A multi-dimensional example:
407+ >>> A = np.array([[1, 2, 3], [4, 5, 6]])
408+ >>> A.shape
409+ (2, 3)
410+ >>> B = np.array([[1, 2, 3, 4]])
411+ >>> B.shape
412+ (1, 4)
413+ >>> C = np.multiply.outer(A, B)
414+ >>> C.shape; C
415+ (2, 3, 1, 4)
416+ array([[[[ 1, 2, 3, 4]],
417+ [[ 2, 4, 6, 8]],
418+ [[ 3, 6, 9, 12]]],
419+ [[[ 4, 8, 12, 16]],
420+ [[ 5, 10, 15, 20]],
421+ [[ 6, 12, 18, 24]]]])
422+
423+ """
424+
425+ dpnp .check_supported_arrays_type (
426+ x1 , x2 , scalar_type = True , all_scalars = False
427+ )
428+ if dpnp .isscalar (x1 ) or dpnp .isscalar (x2 ):
429+ _x1 = x1
430+ _x2 = x2
431+ else :
432+ _x1 = x1 [(Ellipsis ,) + (None ,) * x2 .ndim ]
433+ _x2 = x2 [(None ,) * x1 .ndim + (Ellipsis ,)]
434+ return self .__call__ (
435+ _x1 ,
436+ _x2 ,
437+ out = out ,
438+ where = where ,
439+ order = order ,
440+ dtype = dtype ,
441+ subok = subok ,
442+ ** kwargs ,
443+ )
444+
344445
345446class DPNPAngle (DPNPUnaryFunc ):
346447 """Class that implements dpnp.angle unary element-wise functions."""
0 commit comments