def test_apply(self):
self._maybe_skip("apply")
for use_placeholder in False, True:
for shape in self._shapes_to_test:
for dtype in self._dtypes_to_test:
for adjoint in False, True:
with self.test_session(graph=ops.Graph()) as sess:
sess.graph.seed = random_seed.DEFAULT_GRAPH_SEED
operator, mat, feed_dict = self._operator_and_mat_and_feed_dict(
shape, dtype, use_placeholder=use_placeholder)
x = self._make_x(operator, adjoint=adjoint)
op_apply = operator.apply(x, adjoint=adjoint)
mat_apply = math_ops.matmul(mat, x, adjoint_a=adjoint)
if not use_placeholder:
self.assertAllEqual(op_apply.get_shape(), mat_apply.get_shape())
op_apply_v, mat_apply_v = sess.run([op_apply, mat_apply],
feed_dict=feed_dict)
self.assertAC(op_apply_v, mat_apply_v)
linear_operator_test_util.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录