#NEWLINE# def tensor_pattern_to_gpu_pattern( shape , pattern ) : #NEWLINE# #INDENT# gpu_pattern = [ 0 for elem in shape ] #NEWLINE# for idx in pattern : #NEWLINE# #INDENT# gpu_pattern [ idx ] = 1 #NEWLINE# #UNINDENT# gpu_pattern = tuple ( gpu_pattern ) #NEWLINE# return gpu_pattern