Hướng dẫn why is vectorization useful python? - tại sao vector hóa python hữu ích?

Chúng tôi biết rằng hầu hết các ứng dụng phải đối phó với một số lượng lớn các bộ dữ liệu. Do đó, một chức năng không tối ưu không tính đến có thể trở thành một nút cổ chai lớn trong thuật toán của bạn và có thể kết quả vào một mô hình mất nhiều thời gian để chạy. Để đảm bảo rằng mã có hiệu quả tính toán, chúng tôi sẽ sử dụng vector hóa.

Độ phức tạp về thời gian trong việc thực hiện bất kỳ thuật toán nào là rất quan trọng khi quyết định liệu một ứng dụng có đáng tin cậy hay không. Để chạy một thuật toán lớn trong thời gian tối ưu có thể là rất quan trọng khi nói đến ứng dụng đầu ra thời gian thực. Để làm như vậy, Python có một số hàm toán học tiêu chuẩn cho các hoạt động nhanh trên toàn bộ mảng dữ liệu mà không phải viết các vòng lặp. Một trong những thư viện như vậy có chứa chức năng như vậy là Numpy. Hãy để xem làm thế nào chúng ta có thể sử dụng chức năng tiêu chuẩn này trong trường hợp vector hóa.numpy. Let’s see how can we use this standard function in case of vectorization.

Vectorization là gì? Vectorization được sử dụng để tăng tốc mã Python mà không cần sử dụng vòng lặp. Sử dụng một chức năng như vậy có thể giúp giảm thiểu thời gian chạy của mã một cách hiệu quả. Các hoạt động khác nhau đang được thực hiện trên các vectơ như sản phẩm DOT của các vectơ còn được gọi là sản phẩm vô hướng vì nó tạo ra các sản phẩm bên ngoài, đầu ra dẫn đến ma trận vuông có chiều dài x chiều dài của vectơ, phần tử khôn ngoan tạo ra sản phẩm Phần tử của cùng một chỉ số và kích thước của ma trận vẫn không thay đổi.
Vectorization is used to speed up the Python code without using loop. Using such a function can help in minimizing the running time of code efficiently. Various operations are being performed over vector such as dot product of vectors which is also known as scalar product as it produces single output, outer products which results in square matrix of dimension equal to length X length of the vectors, Element wise multiplication which products the element of same indexes and dimension of the matrix remain unchanged.

Chúng ta sẽ thấy các phương pháp cổ điển tốn nhiều thời gian hơn so với việc sử dụng một số hàm tiêu chuẩn bằng cách tính thời gian xử lý của chúng.

Bên ngoài [A, B]: Tính toán sản phẩm bên ngoài của hai vectơ.Multiply [A, B]: Sản phẩm ma trận của hai mảng.DOT [A, B]: Sản phẩm chấm của hai mảng.Zeros [[n, m]]: Trả về một ma trận có hình dạng và loại đã cho, chứa đầy zeros.process_time []: Trả về giá trị [tính theo giây phân đoạn] của tổng của hệ thống và thời gian CPU của người dùng của quy trình hiện tại. Nó không bao gồm thời gian trôi qua trong khi ngủ. Compute the outer product of two vectors.
multiply[a, b]: Matrix product of two arrays.
dot[a, b]: Dot product of two arrays.
zeros[[n, m]]: Return a matrix of given shape and type, filled with zeros.
process_time[]: Return the value [in fractional seconds] of the sum of the system and user CPU time of the current process. It does not include time elapsed during sleep.

Sản phẩm DOT: Sản phẩm DOT là một hoạt động đại số trong đó hai vectơ có độ dài bằng nhau đang được nhân sao cho nó tạo ra một số duy nhất. Sản phẩm chấm thường được gọi là sản phẩm bên trong. Sản phẩm này dẫn đến một số vô hướng. Hãy cùng xem xét hai ma trận A và B có cùng chiều dài, sản phẩm DOT được thực hiện bằng cách sử dụng phép chuyển đổi ma trận đầu tiên và sau đó nhân ma trận toán học của A [chuyển đổi A] và B được theo dõi như trong hình bên dưới.
Dot product is an algebraic operation in which two equal length vectors are being multiplied such that it produces a single number. Dot Product often called as inner product. This product results in a scalar number. Let’s consider two matrix a and b of same length, the dot product is done by taking the transpose of first matrix and then mathematical matrix multiplication of a’[transpose of a] and b is followed as shown in the figure below.

Biểu diễn hình ảnh của sản phẩm DOT -

Dưới đây là mã Python:

import time

import numpy

import array

a ____10

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
1
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
2

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
4
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
5
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
6
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
7
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
9
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
0

Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
1
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
2

Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
3
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
1
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
2

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
4
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
5
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
6
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
7
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
9import4import5
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
0

Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
1import8

import9

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0 time1

time2

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0 time4time5

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
4
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
5
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
6
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
7
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8import1import2

import3time2import5

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0 import7import8 import9

numpy0

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0 time1

numpy3

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8numpy5import5 numpy7numpy8

numpy3

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8import1 import5 numpy7
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8__

array3

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0 time1

array6

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0 array8

array9____10 time1

numpy3

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8a 4import5numpy7a 7

Các

Output:

dot_product = 833323333350000.0
Computation time = 35.59449199999999ms

n_dot_product = 833323333350000
Computation time = 0.1559900000000225ms

& nbsp; Sản phẩm bên ngoài: Sản phẩm tenxơ của hai vectơ tọa độ được gọi là sản phẩm bên ngoài. Hãy cùng xem xét hai vectơ A và B với kích thước

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
12 và
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
13 Sau đó, sản phẩm bên ngoài của vectơ dẫn đến một ma trận hình chữ nhật là
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
14. Nếu hai vectơ có cùng kích thước thì ma trận kết quả sẽ là một ma trận vuông như trong hình.
Outer Product:
The tensor product of two coordinate vectors is termed as Outer product. Let’s consider two vectors a and b with dimension
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
12 and
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
13 then the outer product of the vector results in a rectangular matrix of
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
14
. If two vectors have same dimension then the resultant matrix will be a square matrix as shown in the figure.

Biểu diễn hình ảnh của sản phẩm bên ngoài -

Dưới đây là mã Python:

import time

import numpy

import array

a ____10

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
1
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
2

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
4
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
5
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
6
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
7
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
9
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
0

Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
1
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
2

Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
3
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
1
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
2

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
4
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
5
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
6
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
7
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
9import4import5
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
0

Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
1import8

import9

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0 time1

time2

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0 time4time5

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
4
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
5
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
6
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
7
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8import1import2

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
68
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
4
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
70
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
6
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
7
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8import1
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
75

import3

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
77
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
79import8
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
81

numpy0

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0 time1

numpy3

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
87import5 numpy7
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
90

Các

array3

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0 time1

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
54
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
10

array9____10 time1

numpy3

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
87import5numpy7
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
90

Các

Output:

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms

& NBSP; Phần tử Wise Sản phẩm: Nhân phần yếu tố của hai ma trận là hoạt động đại số trong đó mỗi phần tử của ma trận đầu tiên được nhân với phần tử tương ứng của nó trong ma trận sau. Kích thước của các ma trận phải giống nhau. Xử lý hai ma trận A và B, chỉ số của một phần tử trong A là I và J thì A [I, J] được nhân với B [I, J] tương ứng như trong hình bên dưới.
Element wise Product:
Element-wise multiplication of two matrices is the algebraic operation in which each element of first matrix is multiplied by its corresponding element in the later matrix. Dimension of the matrices should be same.
Consider two matrices a and b, index of an element in a is i and j then a[i, j] is multiplied with b[i, j] respectively as shown in the figure below.

Biểu diễn hình ảnh của sản phẩm khôn ngoan -

Dưới đây là mã Python:

import time

import numpy

import array

a ____10

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
1
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
24
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
3

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
4
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
5
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
6
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
7
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
50
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
0

Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
1
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
2

Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
3
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
1
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
24
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
3

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
4
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
5
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
6
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
7
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
50import4
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
9
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
0

Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
1import8

Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
70
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
56
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
50
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
60

import9

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0 time1

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
4
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
5
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
6
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
7
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8import1import2

import3

Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
86
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
79import8import9

numpy0

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0 time1

numpy3

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
96import5 numpy7
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
99

Các

array3

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0 time1

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
54
outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
0
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
10

array9____10 time1

numpy3

outer_product = [[     0.      0.      0. ...,      0.      0.      0.]
 [   200.    201.    202. ...,    397.    398.    399.]
 [   400.    402.    404. ...,    794.    796.    798.]
 ..., 
 [ 39400.  39597.  39794. ...,  78209.  78406.  78603.]
 [ 39600.  39798.  39996. ...,  78606.  78804.  79002.]
 [ 39800.  39999.  40198. ...,  79003.  79202.  79401.]]

Computation time = 39.821617ms

outer_product = [[    0     0     0 ...,     0     0     0]
 [  200   201   202 ...,   397   398   399]
 [  400   402   404 ...,   794   796   798]
 ..., 
 [39400 39597 39794 ..., 78209 78406 78603]
 [39600 39798 39996 ..., 78606 78804 79002]
 [39800 39999 40198 ..., 79003 79202 79401]]

Computation time = 0.2809480000000031ms
8
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
96import5numpy7
Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms
99

Các

Output:

Element wise Product = [  0.00000000e+00   5.00010000e+04   1.00004000e+05 ...,   4.99955001e+09
   4.99970000e+09   4.99985000e+09]

Computation time = 23.516678000000013ms

Element wise Product = [        0     50001    100004 ..., 704582713 704732708 704882705]
Computation time = 0.2250640000000248ms

Mục đích của vector hóa là gì?

Trong học máy, vector hóa là một bước trong trích xuất tính năng. Ý tưởng là để có được một số tính năng riêng biệt ra khỏi văn bản để mô hình đào tạo, bằng cách chuyển đổi văn bản thành các vectơ số.to get some distinct features out of the text for the model to train on, by converting text to numerical vectors.

Tại sao Vectorization lại hiệu quả hơn?

Một lý do chính tại sao vector hóa nhanh hơn so với đối tác vòng lặp của nó là do việc thực hiện cơ bản của các hoạt động numpy. Như nhiều bạn đã biết [nếu bạn quen thuộc với Python], Python là một ngôn ngữ được đánh máy động.due to the underlying implementation of Numpy operations. As many of you know [if you're familiar with Python], Python is a dynamically typed language.

Những lợi thế nào mà Vector hóa với các mảng Numpy cung cấp?

Khái niệm về các hoạt động vector hóa trên Numpy cho phép sử dụng các chức năng và hoạt động toán học tối ưu và được biên dịch trước hơn trên các đối tượng mảng và chuỗi dữ liệu numpy.Đầu ra và hoạt động sẽ tăng tốc khi so sánh với các hoạt động không đơn giản.allows the use of more optimal and pre-compiled functions and mathematical operations on NumPy array objects and data sequences. The Output and Operations will speed up when compared to simple non-vectorized operations.

Vectorization có nghĩa là gì trong Python?

Vectorization là một kỹ thuật thực hiện các hoạt động mảng mà không cần sử dụng cho các vòng lặp.Thay vào đó, chúng tôi sử dụng các chức năng được xác định bởi các mô -đun khác nhau được tối ưu hóa cao giúp giảm thời gian chạy và thực hiện của mã.a technique of implementing array operations without using for loops. Instead, we use functions defined by various modules which are highly optimized that reduces the running and execution time of code.

Bài Viết Liên Quan

Chủ Đề