当前位置: 首页>>代码示例>>Python>>正文


Python random_seed.DEFAULT_GRAPH_SEED属性代码示例

本文整理汇总了Python中tensorflow.python.framework.random_seed.DEFAULT_GRAPH_SEED属性的典型用法代码示例。如果您正苦于以下问题:Python random_seed.DEFAULT_GRAPH_SEED属性的具体用法?Python random_seed.DEFAULT_GRAPH_SEED怎么用?Python random_seed.DEFAULT_GRAPH_SEED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在tensorflow.python.framework.random_seed的用法示例。


在下文中一共展示了random_seed.DEFAULT_GRAPH_SEED属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_det

# 需要导入模块: from tensorflow.python.framework import random_seed [as 别名]
# 或者: from tensorflow.python.framework.random_seed import DEFAULT_GRAPH_SEED [as 别名]
def test_det(self):
    self._skip_if_tests_to_skip_contains("det")
    for use_placeholder in False, True:
      for shape in self._shapes_to_test:
        for dtype in self._dtypes_to_test:
          if dtype.is_complex:
            self.skipTest(
                "tf.matrix_determinant does not work with complex, so this "
                "test is being skipped.")
          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)
            op_det = operator.determinant()
            if not use_placeholder:
              self.assertAllEqual(shape[:-2], op_det.get_shape())
            op_det_v, mat_det_v = sess.run(
                [op_det, linalg_ops.matrix_determinant(mat)],
                feed_dict=feed_dict)
            self.assertAC(op_det_v, mat_det_v) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:22,代码来源:linear_operator_test_util.py

示例2: test_log_abs_det

# 需要导入模块: from tensorflow.python.framework import random_seed [as 别名]
# 或者: from tensorflow.python.framework.random_seed import DEFAULT_GRAPH_SEED [as 别名]
def test_log_abs_det(self):
    self._skip_if_tests_to_skip_contains("log_abs_det")
    for use_placeholder in False, True:
      for shape in self._shapes_to_test:
        for dtype in self._dtypes_to_test:
          if dtype.is_complex:
            self.skipTest(
                "tf.matrix_determinant does not work with complex, so this "
                "test is being skipped.")
          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)
            op_log_abs_det = operator.log_abs_determinant()
            mat_log_abs_det = math_ops.log(
                math_ops.abs(linalg_ops.matrix_determinant(mat)))
            if not use_placeholder:
              self.assertAllEqual(shape[:-2], op_log_abs_det.get_shape())
            op_log_abs_det_v, mat_log_abs_det_v = sess.run(
                [op_log_abs_det, mat_log_abs_det],
                feed_dict=feed_dict)
            self.assertAC(op_log_abs_det_v, mat_log_abs_det_v) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:24,代码来源:linear_operator_test_util.py

示例3: test_add_to_tensor

# 需要导入模块: from tensorflow.python.framework import random_seed [as 别名]
# 或者: from tensorflow.python.framework.random_seed import DEFAULT_GRAPH_SEED [as 别名]
def test_add_to_tensor(self):
    self._skip_if_tests_to_skip_contains("add_to_tensor")
    for use_placeholder in False, True:
      for shape in self._shapes_to_test:
        for dtype in self._dtypes_to_test:
          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)
            op_plus_2mat = operator.add_to_tensor(2 * mat)

            if not use_placeholder:
              self.assertAllEqual(shape, op_plus_2mat.get_shape())

            op_plus_2mat_v, mat_v = sess.run([op_plus_2mat, mat],
                                             feed_dict=feed_dict)

            self.assertAC(op_plus_2mat_v, 3 * mat_v) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:20,代码来源:linear_operator_test_util.py

示例4: test_diag_part

# 需要导入模块: from tensorflow.python.framework import random_seed [as 别名]
# 或者: from tensorflow.python.framework.random_seed import DEFAULT_GRAPH_SEED [as 别名]
def test_diag_part(self):
    self._skip_if_tests_to_skip_contains("diag_part")
    for use_placeholder in False, True:
      for shape in self._shapes_to_test:
        for dtype in self._dtypes_to_test:
          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)
            op_diag_part = operator.diag_part()
            mat_diag_part = array_ops.matrix_diag_part(mat)

            if not use_placeholder:
              self.assertAllEqual(
                  mat_diag_part.get_shape(), op_diag_part.get_shape())

            op_diag_part_, mat_diag_part_ = sess.run(
                [op_diag_part, mat_diag_part], feed_dict=feed_dict)

            self.assertAC(op_diag_part_, mat_diag_part_) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:22,代码来源:linear_operator_test_util.py

示例5: test_det

# 需要导入模块: from tensorflow.python.framework import random_seed [as 别名]
# 或者: from tensorflow.python.framework.random_seed import DEFAULT_GRAPH_SEED [as 别名]
def test_det(self):
    self._maybe_skip("det")
    for use_placeholder in False, True:
      for shape in self._shapes_to_test:
        for dtype in self._dtypes_to_test:
          if dtype.is_complex:
            self.skipTest(
                "tf.matrix_determinant does not work with complex, so this "
                "test is being skipped.")
          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)
            op_det = operator.determinant()
            if not use_placeholder:
              self.assertAllEqual(shape[:-2], op_det.get_shape())
            op_det_v, mat_det_v = sess.run(
                [op_det, linalg_ops.matrix_determinant(mat)],
                feed_dict=feed_dict)
            self.assertAC(op_det_v, mat_det_v) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:22,代码来源:linear_operator_test_util.py

示例6: test_apply

# 需要导入模块: from tensorflow.python.framework import random_seed [as 别名]
# 或者: from tensorflow.python.framework.random_seed import DEFAULT_GRAPH_SEED [as 别名]
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) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:20,代码来源:linear_operator_test_util.py

示例7: test_solve

# 需要导入模块: from tensorflow.python.framework import random_seed [as 别名]
# 或者: from tensorflow.python.framework.random_seed import DEFAULT_GRAPH_SEED [as 别名]
def test_solve(self):
    self._maybe_skip("solve")
    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)
              rhs = self._make_rhs(operator, adjoint=adjoint)
              op_solve = operator.solve(rhs, adjoint=adjoint)
              mat_solve = linalg_ops.matrix_solve(mat, rhs, adjoint=adjoint)
              if not use_placeholder:
                self.assertAllEqual(op_solve.get_shape(), mat_solve.get_shape())
              op_solve_v, mat_solve_v = sess.run([op_solve, mat_solve],
                                                 feed_dict=feed_dict)
              self.assertAC(op_solve_v, mat_solve_v) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:20,代码来源:linear_operator_test_util.py

示例8: testRandomSeed

# 需要导入模块: from tensorflow.python.framework import random_seed [as 别名]
# 或者: from tensorflow.python.framework.random_seed import DEFAULT_GRAPH_SEED [as 别名]
def testRandomSeed(self):
    test_cases = [
        # Each test case is a tuple with input to get_seed:
        # (input_graph_seed, input_op_seed)
        # and output from get_seed:
        # (output_graph_seed, output_op_seed)
        ((None, None), (None, None)),
        ((None, 1), (random_seed.DEFAULT_GRAPH_SEED, 1)),
        ((1, None), (1, 0)),  # 0 will be the default_graph._lastid.
        ((1, 1), (1, 1)),
    ]
    for tc in test_cases:
      tinput, toutput = tc[0], tc[1]
      random_seed.set_random_seed(tinput[0])
      g_seed, op_seed = random_seed.get_seed(tinput[1])
      msg = 'test_case = {0}, got {1}, want {2}'.format(tinput,
                                                        (g_seed, op_seed),
                                                        toutput)
      self.assertEqual((g_seed, op_seed), toutput, msg=msg)
      random_seed.set_random_seed(None) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:22,代码来源:random_seed_test.py

示例9: setUp

# 需要导入模块: from tensorflow.python.framework import random_seed [as 别名]
# 或者: from tensorflow.python.framework.random_seed import DEFAULT_GRAPH_SEED [as 别名]
def setUp(self):
    self._ClearCachedSession()
    random.seed(random_seed.DEFAULT_GRAPH_SEED)
    np.random.seed(random_seed.DEFAULT_GRAPH_SEED)
    ops.reset_default_graph()
    ops.get_default_graph().seed = random_seed.DEFAULT_GRAPH_SEED 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:8,代码来源:test_util.py

示例10: test_to_dense

# 需要导入模块: from tensorflow.python.framework import random_seed [as 别名]
# 或者: from tensorflow.python.framework.random_seed import DEFAULT_GRAPH_SEED [as 别名]
def test_to_dense(self):
    self._skip_if_tests_to_skip_contains("to_dense")
    for use_placeholder in False, True:
      for shape in self._shapes_to_test:
        for dtype in self._dtypes_to_test:
          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)
            op_dense = operator.to_dense()
            if not use_placeholder:
              self.assertAllEqual(shape, op_dense.get_shape())
            op_dense_v, mat_v = sess.run([op_dense, mat], feed_dict=feed_dict)
            self.assertAC(op_dense_v, mat_v) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:16,代码来源:linear_operator_test_util.py

示例11: test_matmul

# 需要导入模块: from tensorflow.python.framework import random_seed [as 别名]
# 或者: from tensorflow.python.framework.random_seed import DEFAULT_GRAPH_SEED [as 别名]
def test_matmul(self):
    self._skip_if_tests_to_skip_contains("matmul")
    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:
            for adjoint_arg 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)
                # If adjoint_arg, compute A X^H^H = A X.
                if adjoint_arg:
                  op_matmul = operator.matmul(
                      linear_operator_util.matrix_adjoint(x),
                      adjoint=adjoint, adjoint_arg=adjoint_arg)
                else:
                  op_matmul = operator.matmul(x, adjoint=adjoint)
                mat_matmul = math_ops.matmul(mat, x, adjoint_a=adjoint)
                if not use_placeholder:
                  self.assertAllEqual(
                      op_matmul.get_shape(), mat_matmul.get_shape())
                op_matmul_v, mat_matmul_v = sess.run(
                    [op_matmul, mat_matmul], feed_dict=feed_dict)
                self.assertAC(op_matmul_v, mat_matmul_v) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:28,代码来源:linear_operator_test_util.py

示例12: test_to_dense

# 需要导入模块: from tensorflow.python.framework import random_seed [as 别名]
# 或者: from tensorflow.python.framework.random_seed import DEFAULT_GRAPH_SEED [as 别名]
def test_to_dense(self):
    self._maybe_skip("to_dense")
    for use_placeholder in False, True:
      for shape in self._shapes_to_test:
        for dtype in self._dtypes_to_test:
          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)
            op_dense = operator.to_dense()
            if not use_placeholder:
              self.assertAllEqual(shape, op_dense.get_shape())
            op_dense_v, mat_v = sess.run([op_dense, mat], feed_dict=feed_dict)
            self.assertAC(op_dense_v, mat_v) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:16,代码来源:linear_operator_test_util.py

示例13: setUp

# 需要导入模块: from tensorflow.python.framework import random_seed [as 别名]
# 或者: from tensorflow.python.framework.random_seed import DEFAULT_GRAPH_SEED [as 别名]
def setUp(self):
    self._ClearCachedSession()
    random.seed(random_seed.DEFAULT_GRAPH_SEED)
    np.random.seed(random_seed.DEFAULT_GRAPH_SEED)
    # Note: The following line is necessary because some test methods may error
    # out from within nested graph contexts (e.g., via assertRaises and
    # assertRaisesRegexp), which may leave ops._default_graph_stack non-empty
    # under certain versions of Python. That would cause
    # ops.reset_default_graph() to throw an exception if the stack were not
    # cleared first.
    ops._default_graph_stack.reset()  # pylint: disable=protected-access
    ops.reset_default_graph()
    ops.get_default_graph().seed = random_seed.DEFAULT_GRAPH_SEED 
开发者ID:PacktPublishing,项目名称:Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda,代码行数:15,代码来源:test_util.py


注:本文中的tensorflow.python.framework.random_seed.DEFAULT_GRAPH_SEED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。