outer¶
- nvtripy.outer(vec1: Tensor, vec2: Tensor) Tensor [source]¶
Computes the outer product of 1D vectors
vec1
andvec2
, such that the output shape is \((m, n)\) if the inputs are of size \((m,)\) and \((n,)\) respectively.- Parameters:
- Returns:
[dtype=T1] The outer product of the input vectors.
- Return type:
Example
1v1 = tp.arange(5, dtype=tp.float32) 2v2 = tp.arange(4, dtype=tp.float32) 3output = tp.outer(v1, v2)
Local Variables¶>>> v1 tensor([0, 1, 2, 3, 4], dtype=float32, loc=gpu:0, shape=(5,)) >>> v2 tensor([0, 1, 2, 3], dtype=float32, loc=gpu:0, shape=(4,)) >>> output tensor( [[0, 0, 0, 0], [0, 1, 2, 3], [0, 2, 4, 6], [0, 3, 6, 9], [0, 4, 8, 12]], dtype=float32, loc=gpu:0, shape=(5, 4))