Convolution 3D operator in NDHWC layout. Parameters ---------- a_np : numpy.ndarray 5-D with shape [batch, in_channel, in_depth, in_height, in_width] w_np : numpy.ndarray 5-D with shape [num_filter, in_channel, filter_depth, filter_height, filter_width] stride
(a_np, w_np, stride, padding, groups=1)
| 88 | |
| 89 | |
| 90 | def conv3d_ndhwc_python(a_np, w_np, stride, padding, groups=1): |
| 91 | """Convolution 3D operator in NDHWC layout. |
| 92 | |
| 93 | Parameters |
| 94 | ---------- |
| 95 | a_np : numpy.ndarray |
| 96 | 5-D with shape [batch, in_channel, in_depth, in_height, in_width] |
| 97 | |
| 98 | w_np : numpy.ndarray |
| 99 | 5-D with shape [num_filter, in_channel, filter_depth, filter_height, filter_width] |
| 100 | |
| 101 | stride : int or a list/tuple of three ints |
| 102 | Stride size, or [stride_depth, stride_height, stride_width] |
| 103 | |
| 104 | padding : int or str or a list/tuple of three ints |
| 105 | Padding size, or ['VALID', 'SAME'], or [pad_depth, pad_height, pad_width] |
| 106 | |
| 107 | groups : int |
| 108 | Number of groups |
| 109 | |
| 110 | Returns |
| 111 | ------- |
| 112 | b_np : np.ndarray |
| 113 | 5-D with shape [batch, out_channel, out_depth, out_height, out_width] |
| 114 | """ |
| 115 | a_slices = np.array_split(a_np, groups, axis=4) |
| 116 | w_slices = np.array_split(w_np, groups, axis=4) |
| 117 | b_slices = [ |
| 118 | _conv3d_ndhwc_python(a_slice, w_slice, stride, padding) |
| 119 | for a_slice, w_slice in zip(a_slices, w_slices) |
| 120 | ] |
| 121 | b_np = np.concatenate(b_slices, axis=4) |
| 122 | return b_np |
nothing calls this directly
no test coverage detected
searching dependent graphs…