已知array1和array2均为数组类型
【以下是控制台的输入输出说明两个数组的大小和类型】
In: array1
Out:
array([ True, False, True, True, True, True, True, True, True], dtype=bool)
In: array1.shape
Out: (9L,)
In: array2
Out:
array([[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
...,
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0]])
In:array2.shape
Out: (512L, 512L)
我想问的是array1[array2]到底做了什么,到底索引了什么,明明两个数组的维数不一样,本人刚从C语言转过来,希望能得到指点
以下是array1[array2]的输出结果
Out:
array([[ True, True, True, ..., True, True, True],
[ True, True, True, ..., True, True, True],
[ True, True, True, ..., True, True, True],
...,
[ True, True, True, ..., True, True, True],
[ True, True, True, ..., True, True, True],
[ True, True, True, ..., True, True, True]], dtype=bool)