Xem thảo luận
Cải thiện bài viết
Lưu bài viết
Xem thảo luận
Cải thiện bài viết
Lưu bài viết
Đọc function is used when we want to compute the multiplication of two array. It returns the product of arr1 and arr2, element-wise.
Bàn luận numpy.multiply[arr1, arr2, /, out=None, *, where=True, casting=’same_kind’, order=’K’, dtype=None, subok=True[, signature, extobj], ufunc ‘multiply’]
Hàm
numpy.multiply[]
được sử dụng khi chúng ta muốn tính toán phép nhân của hai mảng. Nó trả về sản phẩm của ARR1 và ARR2, phần tử khôn ngoan.
arr1: [array_like or scalar]1st Input array.
arr2: [array_like or scalar]2nd Input array.
dtype: The type of the returned array. By default, the dtype of arr is used.
out: [ndarray, optional] A location into which the result is stored.
-> If provided, it must have a shape that the inputs broadcast to.
-> If not provided or None, a freshly-allocated array is returned.
where: [array_like, optional] Values of True indicate to calculate the ufunc at that position, values of False indicate to leave the value in the output alone.
**kwargs: Allows to pass keyword variable length of argument to a function. Used when we want to handle named argument in a function.Cú pháp: numpy.multiply [ARR1, ARR2, /, OUT = Không, *, trong đó = true, casting = 'giống nhau_kind', order = 'k', dtype = none, subok = true [ nhân'] [ndarray or scalar] The product of arr1 and arr2, element-wise.
Tham số: ARR1: [Array_Lhe hoặc Scalar] Mảng đầu vào đầu tiên.Arr2: [Array_Lhe hoặc Scalar] Mảng đầu vào thứ 2.DTYPE: Loại của mảng được trả về. Theo mặc định, DTYPE của ARR được sử dụng. -> Nếu không được cung cấp hoặc không có, một mảng mới được phân bổ được trả về. Ở đâu: [Array_Like, Tùy chọn] Các giá trị của True cho biết để tính toán UFUNC ở vị trí đó, các giá trị của sai chỉ ra giá trị trong đầu ra. ** KWARGS: Cho phép chuyển độ dài biến từ khóa của đối số cho một hàm. Được sử dụng khi chúng tôi muốn xử lý đối số được đặt tên trong một hàm.
Trả về: [Ndarray hoặc Scalar] Sản phẩm của ARR1 và ARR2, phần tử khôn ngoan.
Ví dụ 1 :
import
numpy as geek
in_num1
=
4
in_num2
=
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]1
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]2
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]3
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]4
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]5
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]2
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]3
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]8
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]9
1st Input array : [[ 2 -7 5]
[-6 2 0]]
2nd Input array : [[ 0 -7 8]
[ 5 -2 9]]
Resultant output array: [[ 0 49 40]
[-30 -4 0]]
0____7 1st Input array : [[ 2 -7 5]
[-6 2 0]]
2nd Input array : [[ 0 -7 8]
[ 5 -2 9]]
Resultant output array: [[ 0 49 40]
[-30 -4 0]]
2
1st Input number : 4 2nd Input number : 6 output number : 24
1st Input array : [[ 2 -7 5]
[-6 2 0]]
2nd Input array : [[ 0 -7 8]
[ 5 -2 9]]
Resultant output array: [[ 0 49 40]
[-30 -4 0]]
2 1st Input array : [[ 2 -7 5]
[-6 2 0]]
2nd Input array : [[ 0 -7 8]
[ 5 -2 9]]
Resultant output array: [[ 0 49 40]
[-30 -4 0]]
31st Input array : [[ 2 -7 5]
[-6 2 0]]
2nd Input array : [[ 0 -7 8]
[ 5 -2 9]]
Resultant output array: [[ 0 49 40]
[-30 -4 0]]
51st Input array : [[ 2 -7 5]
[-6 2 0]]
2nd Input array : [[ 0 -7 8]
[ 5 -2 9]]
Resultant output array: [[ 0 49 40]
[-30 -4 0]]
6
The following code is also known as the Hadamard product which is nothing but the element-wise-product of the two matrices. It is the most commonly used product for those who are interested in Machine Learning or statistics.
Trả về: [Ndarray hoặc Scalar] Sản phẩm của ARR1 và ARR2, phần tử khôn ngoan.
Ví dụ 1 :
import
numpy as geek
in_num1
=
4
in_num2
=
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]1
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]2
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]3
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]4
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]5
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]2
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]3
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]8
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]9
1st Input array : [[ 2 -7 5]
[-6 2 0]]
2nd Input array : [[ 0 -7 8]
[ 5 -2 9]]
Resultant output array: [[ 0 49 40]
[-30 -4 0]]
0____7 1st Input array : [[ 2 -7 5]
[-6 2 0]]
2nd Input array : [[ 0 -7 8]
[ 5 -2 9]]
Resultant output array: [[ 0 49 40]
[-30 -4 0]]
2
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]2
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]3
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]5
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]6
Trả về: [Ndarray hoặc Scalar] Sản phẩm của ARR1 và ARR2, phần tử khôn ngoan.
4
0=
4
2numpy.multiply[]
2numpy.multiply[]
3numpy.multiply[]
4numpy.multiply[]
5numpy.multiply[]
3numpy.multiply[]
7numpy.multiply[]
8numpy.multiply[]
4
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]1
numpy.multiply[]
3numpy.multiply[]
2numpy.multiply[]
3import
4import
5Ví dụ 1 :
in_num1
=
4
in_num2
=
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]1
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]22
=
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]24
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]25
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]26
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]2
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]3
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]4
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]5
1st Input array : [[ 2 -7 5]
[-6 2 0]]
2nd Input array : [[ 0 -7 8]
[ 5 -2 9]]
Resultant output array: [[ 0 49 40]
[-30 -4 0]]
0____7 1st Input array : [[ 2 -7 5]
[-6 2 0]]
2nd Input array : [[ 0 -7 8]
[ 5 -2 9]]
Resultant output array: [[ 0 49 40]
[-30 -4 0]]
2
1st Input array : [[ 2 -7 5] [-6 2 0]] 2nd Input array : [[ 0 -7 8] [ 5 -2 9]] Resultant output array: [[ 0 49 40] [-30 -4 0]]