하나의 차원을 따라 두 개의 분할 영역 객체가 정의되어 있으면 결합하여 numpy 배열을 분할하는 데 사용할 수있는 다차원 분할 객체를 얻을 수 있습니까?numpy 배열 슬라이스를 위해 다차원 분할 영역으로 분할 작성
slice2d = (s1, s2)
mat[slice2d]
가 작동합니다
mat = np.zeros((10,10), dtype=np.uint8)
s1 = slice(0,5)
s2 = slice(0,5)
mat[s1,s2] # I want to achieve this effect with one slice object
slice2d = slice(s1, s2) # does not throw an error
mat[slice2d] # but this does not work
슬라이스 객체 여야하나요? 'tup2d = (s1, s2)'는 단일 객체이고'mat [tup2d] '는'mat [s1, s2]'와 같습니다 ... – unutbu