コード例 #1
0
    def testEmpty(self):
        for s in self.all_shapes:
            actual = array_ops.empty(s)
            expected = np.empty(s)
            msg = 'shape: {}'.format(s)
            self.match_shape(actual, expected, msg)
            self.match_dtype(actual, expected, msg)

        for s, t in itertools.product(self.all_shapes, self.all_types):
            actual = array_ops.empty(s, t)
            expected = np.empty(s, t)
            msg = 'shape: {}, dtype: {}'.format(s, t)
            self.match_shape(actual, expected, msg)
            self.match_dtype(actual, expected, msg)
コード例 #2
0
 def testIx_(self):
   possible_arys = [[True, True], [True, False], [False, False],
                    list(range(5)), array_ops.empty(0, dtype=np.int64)]
   for r in range(len(possible_arys)):
     for arys in itertools.combinations_with_replacement(possible_arys, r):
       tnp_ans = array_ops.ix_(*arys)
       onp_ans = np.ix_(*arys)
       for t, o in zip(tnp_ans, onp_ans):
         self.match(t, o)