def shift_multi(x, wrg=0.1, hrg=0.1, is_random=False, row_index=0, col_index=1, channel_index=2, fill_mode='nearest', cval=0.0):
 (h, w) = (x[0].shape[row_index], x[0].shape[col_index])
 if is_random:
  tx = (np.random.uniform((- hrg), hrg) * h)
  ty = (np.random.uniform((- wrg), wrg) * w)
 else:
  (tx, ty) = ((hrg * h), (wrg * w))
 translation_matrix = np.array([[1, 0, tx], [0, 1, ty], [0, 0, 1]])
 transform_matrix = translation_matrix
 results = []
 for data in x:
  results.append(apply_transform(data, transform_matrix, channel_index, fill_mode, cval))
 return np.asarray(results)

def shift_multi ( x , wrg = 0.1 , hrg = 0.1 , is_random = False , row_index = 0 , col_index = 1 , channel_index = 2 , fill_mode = 'nearest' , cval = 0.0 ) : ( h , w ) = ( x [ 0 ] . shape [ row_index ] , x [ 0 ] . shape [ col_index ] ) if is_random : tx = ( np . random . uniform ( ( - hrg ) , hrg ) * h ) ty = ( np . random . uniform ( ( - wrg ) , wrg ) * w ) else : ( tx , ty ) = ( ( hrg * h ) , ( wrg * w ) ) translation_matrix = np . array ( [ [ 1 , 0 , tx ] , [ 0 , 1 , ty ] , [ 0 , 0 , 1 ] ] ) transform_matrix = translation_matrix results = [ ] for data in x : results . append ( apply_transform ( data , transform_matrix , channel_index , fill_mode , cval ) ) return np . asarray ( results )
shift images with the same arguments .