MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / get_binary_kernel

Function get_binary_kernel

monai/networks/layers/simplelayers.py:430–438  ·  view source on GitHub ↗

Create a binary kernel to extract the patches. The window size HxWxD will create a (H*W*D)xHxWxD kernel.

(window_size: Sequence[int], dtype=torch.float, device=None)

Source from the content-addressed store, hash-verified

428
429
430def get_binary_kernel(window_size: Sequence[int], dtype=torch.float, device=None) -> torch.Tensor:
431 """
432 Create a binary kernel to extract the patches.
433 The window size HxWxD will create a (H*W*D)xHxWxD kernel.
434 """
435 win_size = convert_to_tensor(window_size, int, wrap_sequence=True)
436 prod = torch.prod(win_size)
437 s = [prod, 1, *win_size]
438 return torch.diag(torch.ones(prod, dtype=dtype, device=device)).view(s) # type: ignore
439
440
441def median_filter(

Callers 2

median_filterFunction · 0.85
__init__Method · 0.85

Calls 1

convert_to_tensorFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…