def testFullLike(self):
     # List of 2-tuples of fill value and shape.
     data = [
         (5, ()),
         (5, (7, )),
         (5., (7, )),
         ([5, 8], (2, )),
         ([5, 8], (3, 2)),
         ([[5], [8]], (2, 3)),
         ([[5], [8]], (3, 2, 5)),
         ([[5.], [8.]], (3, 2, 5)),
     ]
     zeros_builders = [array_creation.zeros, np.zeros]
     for f, s in data:
         for fn1, fn2, arr_dtype in itertools.product(
                 self.array_transforms, zeros_builders, self.all_types):
             fill_value = fn1(f)
             arr = fn2(s, arr_dtype)
             self.match(array_creation.full_like(arr, fill_value),
                        np.full_like(arr, fill_value))
             for dtype in self.all_types:
                 self.match(
                     array_creation.full_like(arr, fill_value, dtype=dtype),
                     np.full_like(arr, fill_value, dtype=dtype))
示例#2
0
def isposinf(x):
    return x == array_creation.full_like(x, np.inf)
示例#3
0
def isneginf(x):
    return x == array_creation.full_like(x, -np.inf)