6a4fa82792bddc6126eaf944956f49f0a0cb7ca7,kornia/filters/sobel.py,Sobel,forward,#Sobel#Any#,152
Before Change
"normalized=" + str(self.normalized) + ")"
def forward(self, input: torch.Tensor) -> torch.Tensor: // type: ignore
if not torch.is_tensor(input):
raise TypeError("Input type is not a torch.Tensor. Got {}"
.format(type(input)))
if not len(input.shape) == 4:
raise ValueError("Invalid input shape, we expect BxCxHxW. Got: {}"
.format(input.shape))
// comput the x/y gradients
edges: torch.Tensor = spatial_gradient(input,
normalized=self.normalized)
// unpack the edges
gx: torch.Tensor = edges[:, :, 0]
gy: torch.Tensor = edges[:, :, 1]
// compute gradient maginitude
magnitude: torch.Tensor = torch.sqrt(gx * gx + gy * gy + self.eps)
return magnitude
// functiona api
// TODO: In terms of functional API, there should not be any initialization of an nn.Module.
After Change
"normalized=" + str(self.normalized) + ")"
def forward(self, input: torch.Tensor) -> torch.Tensor:
return sobel(input, self.normalized, self.eps)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 24
Instances
Project Name: arraiy/torchgeometry
Commit Name: 6a4fa82792bddc6126eaf944956f49f0a0cb7ca7
Time: 2020-12-22
Author: edgar.riba@gmail.com
File Name: kornia/filters/sobel.py
Class Name: Sobel
Method Name: forward
Project Name: arraiy/torchgeometry
Commit Name: 6a4fa82792bddc6126eaf944956f49f0a0cb7ca7
Time: 2020-12-22
Author: edgar.riba@gmail.com
File Name: kornia/filters/sobel.py
Class Name: Sobel
Method Name: forward
Project Name: arraiy/torchgeometry
Commit Name: b9088d6735e94b600ab9f1e42f6f7aa56eafa96f
Time: 2019-06-25
Author: edgar.riba@gmail.com
File Name: kornia/filters/laplacian.py
Class Name: Laplacian
Method Name: forward
Project Name: arraiy/torchgeometry
Commit Name: b51bfe75d02eeab204501f2695845ff28f4a87c2
Time: 2019-06-25
Author: edgar.riba@gmail.com
File Name: kornia/filters/gaussian.py
Class Name: GaussianBlur2d
Method Name: forward