batched_outer#

ivy.batched_outer(tensors, /, *, out=None)[source]#

Return a generalized outer product of the tensors.

Parameters:

tensors (Sequence[Union[Array, NativeArray]]) – list of tensors of shape (n_samples, J1, …, JN) , (n_samples, K1, …, KM) …

Return type:

Array

Returns:

outer product of tensors – of shape (n_samples, J1, …, JN, K1, …, KM, …)

Examples

>>> a = ivy.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])
>>> b = ivy.array([[[.1, .2], [.3, .4]], [[.5, .6], [.7, .8]]])
>>> result = ivy.batched_outer([a, b])
>>> print(result)
ivy.array([[[[[0.1, 0.2],
      [0.30000001, 0.40000001]],
     [[0.2       , 0.40000001],
      [0.60000002, 0.80000001]]],
    [[[0.3       , 0.60000001],
      [0.90000004, 1.20000002]],
     [[0.40000001, 0.80000001],
      [1.20000005, 1.60000002]]]],
   [[[[2.5       , 3.00000012],
      [3.49999994, 4.00000006]],
     [[3.        , 3.60000014],
      [4.19999993, 4.80000007]]],
    [[[3.5       , 4.20000017],
      [4.89999992, 5.60000008]],
     [[4.        , 4.80000019],
      [5.5999999 , 6.4000001 ]]]]])
Array.batched_outer(self, tensors, /, *, out=None)[source]#

Ivy Array instance method variant of ivy.batched_outer. This method simply wraps the function, and so the docstring for ivy.batched_outer also applies to this method with minimal changes.

Parameters:

tensors (Sequence[Union[Array, NativeArray]]) – list of tensors of shape (n_samples, J1, …, JN) , (n_samples, K1, …, KM) …

Return type:

Array

Returns:

outer product of tensors – of shape (n_samples, J1, …, JN, K1, …, KM, …)

Examples

>>> a = ivy.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])
>>> b = ivy.array([[[.1, .2], [.3, .4]], [[.5, .6], [.7, .8]]])
>>> result = ivy.batched_outer(a, b)
>>> print(result)
ivy.array([[[[[0.1, 0.2],
      [0.30000001, 0.40000001]],
     [[0.2       , 0.40000001],
      [0.60000002, 0.80000001]]],
    [[[0.3       , 0.60000001],
      [0.90000004, 1.20000002]],
     [[0.40000001, 0.80000001],
      [1.20000005, 1.60000002]]]],
   [[[[2.5       , 3.00000012],
      [3.49999994, 4.00000006]],
     [[3.        , 3.60000014],
      [4.19999993, 4.80000007]]],
    [[[3.5       , 4.20000017],
      [4.89999992, 5.60000008]],
     [[4.        , 4.80000019],
      [5.5999999 , 6.4000001 ]]]]])
Container.batched_outer(self, tensors, /, *, out=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#

ivy.Container instance method variant of ivy.batched_outer. This method simply wraps the function, and so the docstring for ivy.batched_outer also applies to this method with minimal changes.

Parameters:

tensors (Sequence[Union[Container, Array, NativeArray]]) – list of tensors of shape (n_samples, J1, …, JN) , (n_samples, K1, …, KM) …

Return type:

Container

Returns:

outer product of tensors – of shape (n_samples, J1, …, JN, K1, …, KM, …)

Examples

>>> a = ivy.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])
>>> b = ivy.array([[[.1, .2], [.3, .4]], [[.5, .6], [.7, .8]]])
>>> result = ivy.batched_outer(a, b)
>>> print(result)
ivy.array([[[[[0.1, 0.2],
      [0.30000001, 0.40000001]],
     [[0.2       , 0.40000001],
      [0.60000002, 0.80000001]]],
    [[[0.3       , 0.60000001],
      [0.90000004, 1.20000002]],
     [[0.40000001, 0.80000001],
      [1.20000005, 1.60000002]]]],
   [[[[2.5       , 3.00000012],
      [3.49999994, 4.00000006]],
     [[3.        , 3.60000014],
      [4.19999993, 4.80000007]]],
    [[[3.5       , 4.20000017],
      [4.89999992, 5.60000008]],
     [[4.        , 4.80000019],
      [5.5999999 , 6.4000001 ]]]]])