Exemplo n.º 1
0
 def test_infer_shape(self):
     for sp_format in sparse.sparse_formats:
         for o_type in sparse.float_dtypes:
             self._compile_and_check(
                 self.inputs,
                 [Binomial(sp_format, o_type)(*self.inputs)],
                 self._inputs,
                 self.op_class)
Exemplo n.º 2
0
    def test_op(self):
        for sp_format in sparse.sparse_formats:
            for o_type in sparse.float_dtypes:
                f = theano.function(self.inputs,
                                    Binomial(sp_format, o_type)(*self.inputs))

                tested = f(*self._inputs)

                assert tested.shape == tuple(self._shape)
                assert tested.format == sp_format
                assert tested.dtype == o_type
                assert np.allclose(np.floor(tested.todense()),
                                   tested.todense())