MCPcopy Create free account
hub / github.com/kwuking/TimeMixer / prep_filt_afb2d

Function prep_filt_afb2d

layers/DWT_Decomposition.py:1189–1217  ·  view source on GitHub ↗

Prepares the filters to be of the right form for the afb2d function. In particular, makes the tensors the right shape. It takes mirror images of them as as afb2d uses conv2d which acts like normal correlation. Inputs: h0_col (array-like): low pass column filter bank

(h0_col, h1_col, h0_row=None, h1_row=None, device=None)

Source from the content-addressed store, hash-verified

1187
1188
1189def prep_filt_afb2d(h0_col, h1_col, h0_row=None, h1_row=None, device=None):
1190 """
1191 Prepares the filters to be of the right form for the afb2d function. In
1192 particular, makes the tensors the right shape. It takes mirror images of
1193 them as as afb2d uses conv2d which acts like normal correlation.
1194
1195 Inputs:
1196 h0_col (array-like): low pass column filter bank
1197 h1_col (array-like): high pass column filter bank
1198 h0_row (array-like): low pass row filter bank. If none, will assume the
1199 same as column filter
1200 h1_row (array-like): high pass row filter bank. If none, will assume the
1201 same as column filter
1202 device: which device to put the tensors on to
1203
1204 Returns:
1205 (h0_col, h1_col, h0_row, h1_row)
1206 """
1207 h0_col, h1_col = prep_filt_afb1d(h0_col, h1_col, device)
1208 if h0_row is None:
1209 h0_row, h1_row = h0_col, h1_col
1210 else:
1211 h0_row, h1_row = prep_filt_afb1d(h0_row, h1_row, device)
1212
1213 h0_col = h0_col.reshape((1, 1, -1, 1))
1214 h1_col = h1_col.reshape((1, 1, -1, 1))
1215 h0_row = h0_row.reshape((1, 1, 1, -1))
1216 h1_row = h1_row.reshape((1, 1, 1, -1))
1217 return h0_col, h1_col, h0_row, h1_row
1218
1219
1220def prep_filt_afb1d(h0, h1, device=None):

Callers 2

afb2dFunction · 0.85
afb2d_atrousFunction · 0.85

Calls 1

prep_filt_afb1dFunction · 0.85

Tested by

no test coverage detected