باقی مانده() و fmod() در PyTorch

Summarize this content to 400 words in Persian Lang
*یادداشت ها:
rester() می تواند محاسبه modulo(mod) عملیات مدول پایتون را با دو تانسور 0D یا بیشتر D از عناصر صفر یا بیشتر یا تانسور 0D یا بیشتر D صفر یا بیشتر و یک اسکالر انجام دهد و 0D یا بیشتر را بدست آورد. تانسور D از عناصر صفر یا بیشتر مطابق شکل زیر:
*یادداشت ها:
remainder() قابل استفاده با torch یا یک تانسور
استدلال اول (input) با torch(نوع:tensor یا scalar از int یا float) یا با استفاده از یک تانسور (نوع:tensor از int یا float)(ضروری). *torch باید از اسکالر بدون استفاده کرد input=.
استدلال دوم با torch یا آرگومان 1 با تانسور است other(الزامی-نوع:tensor یا scalar از int یا float).
وجود دارد out استدلال با torch(نوع اختیاری:tensor): *یادداشت ها:
out= باید استفاده شود.
پست من توضیح میده out بحث و جدل.
تنظیمات 0(int) به other می شود ZeroDivisionError.
ترکیب یک اسکالر(input) و اسکالر(other) قابل استفاده نیست.
نتیجه همان علامت را دارد other.
import torch
tensor1 = torch.tensor([9, 7, 6])
tensor2 = torch.tensor([[4, -4, 3], [-2, 5, -5]])
torch.remainder(input=tensor1, other=tensor2)
tensor1.remainder(other=tensor2)
# tensor([[1, -1, 0], [-1, 2, -4]])
torch.remainder(9, other=tensor2)
# tensor([[1, -3, 0], [-1, 4, -1]])
torch.remainder(input=tensor1, other=4)
# tensor([1, 3, 2])
tensor1 = torch.tensor([-9, -7, -6])
tensor2 = torch.tensor([[4, -4, 3], [-2, 5, -5]])
torch.remainder(input=tensor1, other=tensor2)
# tensor([[3, -3, 0],
torch.remainder(-9, other=tensor2)
# tensor([[3, -1, 0], [-1, 1, -4]])
torch.remainder(input=tensor1, other=4)
# tensor([3, 1, 2])
tensor1 = torch.tensor([9.75, 7.08, 6.26])
tensor2 = torch.tensor([[4.26, -4.54, 3.37], [-2.16, 5.43, -5.98]])
torch.remainder(input=tensor1, other=tensor2)
# tensor([[1.2300, -2.0000, 2.8900],
# [-1.0500, 1.6500, -5.7000]])
torch.remainder(9.75, other=tensor2)
# tensor([[1.2300, -3.8700, 3.0100], [-1.0500, 4.3200, -2.2100]])
torch.remainder(input=tensor1, other=4.26)
# tensor([1.2300, 2.8200, 2.0000])
وارد حالت تمام صفحه شوید
از حالت تمام صفحه خارج شوید
fmod() می تواند محاسبه modulo(mod) از C++sstd::fmod را با دو تانسور 0D یا بیشتر D از عناصر صفر یا بیشتر یا تانسور 0D یا بیشتر D صفر یا بیشتر و یک اسکالر انجام دهد و 0D را بدست آورد. یا بیشتر تانسور D از عناصر صفر یا بیشتر مطابق شکل زیر:
*یادداشت ها:
fmod() قابل استفاده با torch یا یک تانسور
استدلال اول (input) با torch یا با استفاده از یک تانسور (الزامی-نوع:tensor از int یا float).
استدلال دوم با torch یا آرگومان 1 با تانسور است other(الزامی-نوع:tensor یا scalar از int یا float).
وجود دارد out استدلال با torch(نوع اختیاری:tensor): *یادداشت ها:
out= باید استفاده شود.
پست من توضیح میده out بحث و جدل.
تنظیمات 0(int) به other می شود ZeroDivisionError.
نتیجه همان علامت تانسور اصلی را دارد.
import torch
tensor1 = torch.tensor([9, 7, 6])
tensor2 = torch.tensor([[4, -4, 3], [-2, 5, -5]])
torch.fmod(input=tensor1, other=tensor2)
tensor1.fmod(other=tensor2)
# tensor([[1, 3, 0], [1, 2, 1]])
torch.fmod(input=tensor1, other=4)
# tensor([1, 3, 2])
tensor1 = torch.tensor([-9, -7, -6])
tensor2 = torch.tensor([[4, -4, 3], [-2, 5, -5]])
torch.fmod(input=tensor1, other=tensor2)
# tensor([[-1, -3, 0], [-1, -2, -1]])
torch.fmod(input=tensor1, other=4)
# tensor([-1, -3, -2])
tensor1 = torch.tensor([9.75, 7.08, 6.26])
tensor2 = torch.tensor([[4.26, -4.54, 3.37], [-2.16, 5.43, -5.98]])
torch.fmod(input=tensor1, other=tensor2)
# tensor([[1.2300, 2.5400, 2.8900], [1.1100, 1.6500, 0.2800]])
torch.fmod(input=tensor1, other=4.26)
# tensor([1.2300, 2.8200, 2.0000])
وارد حالت تمام صفحه شوید
از حالت تمام صفحه خارج شوید
*یادداشت ها:
rester() می تواند محاسبه modulo(mod) عملیات مدول پایتون را با دو تانسور 0D یا بیشتر D از عناصر صفر یا بیشتر یا تانسور 0D یا بیشتر D صفر یا بیشتر و یک اسکالر انجام دهد و 0D یا بیشتر را بدست آورد. تانسور D از عناصر صفر یا بیشتر مطابق شکل زیر:
*یادداشت ها:
-
remainder()
قابل استفاده باtorch
یا یک تانسور - استدلال اول (
input
) باtorch
(نوع:tensor
یاscalar
ازint
یاfloat
) یا با استفاده از یک تانسور (نوع:tensor
ازint
یاfloat
)(ضروری). *torch
باید از اسکالر بدون استفاده کردinput=
. - استدلال دوم با
torch
یا آرگومان 1 با تانسور استother
(الزامی-نوع:tensor
یاscalar
ازint
یاfloat
). - وجود دارد
out
استدلال باtorch
(نوع اختیاری:tensor
): *یادداشت ها:-
out=
باید استفاده شود. -
پست من توضیح میده
out
بحث و جدل.
-
- تنظیمات
0
(int
) بهother
می شودZeroDivisionError
. - ترکیب یک اسکالر(
input
) و اسکالر(other
) قابل استفاده نیست. - نتیجه همان علامت را دارد
other
.
import torch
tensor1 = torch.tensor([9, 7, 6])
tensor2 = torch.tensor([[4, -4, 3], [-2, 5, -5]])
torch.remainder(input=tensor1, other=tensor2)
tensor1.remainder(other=tensor2)
# tensor([[1, -1, 0], [-1, 2, -4]])
torch.remainder(9, other=tensor2)
# tensor([[1, -3, 0], [-1, 4, -1]])
torch.remainder(input=tensor1, other=4)
# tensor([1, 3, 2])
tensor1 = torch.tensor([-9, -7, -6])
tensor2 = torch.tensor([[4, -4, 3], [-2, 5, -5]])
torch.remainder(input=tensor1, other=tensor2)
# tensor([[3, -3, 0],
torch.remainder(-9, other=tensor2)
# tensor([[3, -1, 0], [-1, 1, -4]])
torch.remainder(input=tensor1, other=4)
# tensor([3, 1, 2])
tensor1 = torch.tensor([9.75, 7.08, 6.26])
tensor2 = torch.tensor([[4.26, -4.54, 3.37], [-2.16, 5.43, -5.98]])
torch.remainder(input=tensor1, other=tensor2)
# tensor([[1.2300, -2.0000, 2.8900],
# [-1.0500, 1.6500, -5.7000]])
torch.remainder(9.75, other=tensor2)
# tensor([[1.2300, -3.8700, 3.0100], [-1.0500, 4.3200, -2.2100]])
torch.remainder(input=tensor1, other=4.26)
# tensor([1.2300, 2.8200, 2.0000])
fmod() می تواند محاسبه modulo(mod) از C++sstd::fmod را با دو تانسور 0D یا بیشتر D از عناصر صفر یا بیشتر یا تانسور 0D یا بیشتر D صفر یا بیشتر و یک اسکالر انجام دهد و 0D را بدست آورد. یا بیشتر تانسور D از عناصر صفر یا بیشتر مطابق شکل زیر:
*یادداشت ها:
-
fmod()
قابل استفاده باtorch
یا یک تانسور - استدلال اول (
input
) باtorch
یا با استفاده از یک تانسور (الزامی-نوع:tensor
ازint
یاfloat
). - استدلال دوم با
torch
یا آرگومان 1 با تانسور استother
(الزامی-نوع:tensor
یاscalar
ازint
یاfloat
). - وجود دارد
out
استدلال باtorch
(نوع اختیاری:tensor
): *یادداشت ها:-
out=
باید استفاده شود. -
پست من توضیح میده
out
بحث و جدل.
-
- تنظیمات
0
(int
) بهother
می شودZeroDivisionError
. - نتیجه همان علامت تانسور اصلی را دارد.
import torch
tensor1 = torch.tensor([9, 7, 6])
tensor2 = torch.tensor([[4, -4, 3], [-2, 5, -5]])
torch.fmod(input=tensor1, other=tensor2)
tensor1.fmod(other=tensor2)
# tensor([[1, 3, 0], [1, 2, 1]])
torch.fmod(input=tensor1, other=4)
# tensor([1, 3, 2])
tensor1 = torch.tensor([-9, -7, -6])
tensor2 = torch.tensor([[4, -4, 3], [-2, 5, -5]])
torch.fmod(input=tensor1, other=tensor2)
# tensor([[-1, -3, 0], [-1, -2, -1]])
torch.fmod(input=tensor1, other=4)
# tensor([-1, -3, -2])
tensor1 = torch.tensor([9.75, 7.08, 6.26])
tensor2 = torch.tensor([[4.26, -4.54, 3.37], [-2.16, 5.43, -5.98]])
torch.fmod(input=tensor1, other=tensor2)
# tensor([[1.2300, 2.5400, 2.8900], [1.1100, 1.6500, 0.2800]])
torch.fmod(input=tensor1, other=4.26)
# tensor([1.2300, 2.8200, 2.0000])