*Memos:
- My post explains log() and log1p().
- My post explains log2() and log10().
- My post explains expm1() and sigmoid().
exp() can get the 0D or more D tensor of the zero or more elements by ex from the 0D or more D tensor of zero or more elements as shown below:
*Memos:
-
exp()
can be used with torch or a tensor. - The 1st argument(
input
) withtorch
or using a tensor(Required-Type:tensor
ofint
,float
,complex
orbool
). - There is
out
argument withtorch
(Optional-Default:None
-Type:tensor
): *Memos:-
out=
must be used. -
My post explains
out
argument.
-
- *A
float
tensor is returned unless an input tensor iscomplex
tensor. - The formula is y = ex.
- The graph in Desmos:
import torch
my_tensor = torch.tensor([-2., -1., 0., 1., 2., 3.])
torch.exp(input=my_tensor)
my_tensor.exp()
# tensor([0.1353, 0.3679, 1.0000, 2.7183, 7.3891, 20.0855])
my_tensor = torch.tensor([[-2., -1., 0.],
[1., 2., 3.]])
torch.exp(input=my_tensor)
# tensor([[0.1353, 0.3679, 1.0000],
# [2.7183, 7.3891, 20.0855]])
my_tensor = torch.tensor([[-2, -1, 0],
[1, 2, 3]])
torch.exp(input=my_tensor)
# tensor([[0.1353, 0.3679, 1.0000],
# [2.7183, 7.3891, 20.0855]])
my_tensor = torch.tensor([[-2.+0.j, -1.+0.j, 0.+0.j],
[1.+0.j, 2.+0.j, 3.+0.j]])
torch.exp(input=my_tensor)
# tensor([[0.1353+0.j, 0.3679+0.j, 1.0000+0.j],
# [2.7183+0.j, 7.3891+0.j, 20.0855+0.j]])
my_tensor = torch.tensor([[True, False, True],
[False, True, False]])
torch.exp(input=my_tensor)
# tensor([[2.7183, 1.0000, 2.7183],
# [1.0000, 2.7183, 1.0000]])
exp2() can get the 0D or more D tensor of the zero or more elements by 2x from the 0D or more D tensor of zero or more elements as shown below:
*Memos:
-
exp2()
can be used withtorch
or a tensor. - The 1st argument(
input
) withtorch
or using a tensor(Required-Type:tensor
ofint
,float
,complex
orbool
). - There is
out
argument withtorch
(Optional-Default:None
-Type:tensor
): *Memos:-
out=
must be used. -
My post explains
out
argument.
-
- *A
float
tensor is returned unless an input tensor iscomplex
tensor. -
torch.exp2()
is the alias of torch.special.exp2(). - The formula is y = 2x.
- The graph in Desmos:
import torch
my_tensor = torch.tensor([-2., -1., 0., 1., 2., 3.])
torch.exp2(input=my_tensor)
my_tensor.exp2()
# tensor([0.2500, 0.5000, 1.0000, 2.0000, 4.0000, 8.0000])
my_tensor = torch.tensor([[-2., -1., 0.],
[1., 2., 3.]])
torch.exp2(input=my_tensor)
# tensor([[0.2500, 0.5000, 1.0000],
# [2.0000, 4.0000, 8.0000]])
my_tensor = torch.tensor([[-2, -1, 0],
[1, 2, 3]])
torch.exp2(input=my_tensor)
# tensor([[0.2500, 0.5000, 1.0000],
# [2.0000, 4.0000, 8.0000]])
my_tensor = torch.tensor([[-2.+0.j, -1.+0.j, 0.+0.j],
[1.+0.j, 2.+0.j, 3.+0.j]])
torch.exp2(input=my_tensor)
# tensor([[0.2500+0.j, 0.5000+0.j, 1.0000+0.j],
# [2.0000+0.j, 4.0000+0.j, 8.0000+0.j]])
my_tensor = torch.tensor([[True, False, True],
[False, True, False]])
torch.exp2(input=my_tensor)
# tensor([[2., 1., 2.],
# [1., 2., 1.]])
Top comments (0)