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


Python sparse_ops.sparse_reset_shape函数代码示例

本文整理汇总了Python中tensorflow.python.ops.sparse_ops.sparse_reset_shape函数的典型用法代码示例。如果您正苦于以下问题:Python sparse_reset_shape函数的具体用法?Python sparse_reset_shape怎么用?Python sparse_reset_shape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: testInvalidRank

  def testInvalidRank(self):
    with self.test_session(use_gpu=False):
      sp_input = self._SparseTensor_2x5x6()
      new_shape = np.array([3, 7], dtype=np.int64)

      with self.assertRaises(ValueError):
        sparse_ops.sparse_reset_shape(sp_input, new_shape)
开发者ID:govindap,项目名称:tensorflow,代码行数:7,代码来源:sparse_ops_test.py

示例2: testInvalidRank

  def testInvalidRank(self):
    with test_util.force_cpu():
      sp_input = self._SparseTensor_2x5x6()
      new_shape = np.array([3, 7], dtype=np.int64)

      with self.assertRaises(ValueError):
        sparse_ops.sparse_reset_shape(sp_input, new_shape)
开发者ID:Wajih-O,项目名称:tensorflow,代码行数:7,代码来源:sparse_ops_test.py

示例3: testInvalidDimensionSizeInputUnavailableInGraphConstruction

  def testInvalidDimensionSizeInputUnavailableInGraphConstruction(self):
    sp_input = array_ops.sparse_placeholder(dtype=dtypes.int32)
    with self.test_session(use_gpu=False) as sess:
      new_shape = np.array([3, 7, 5], dtype=np.int64)
      out = sparse_ops.sparse_reset_shape(sp_input, new_shape)

      with self.assertRaisesOpError("x <= y did not hold element-wise"):
        sess.run(out, feed_dict={sp_input: self._SparseTensorValue_2x5x6()})
开发者ID:govindap,项目名称:tensorflow,代码行数:8,代码来源:sparse_ops_test.py

示例4: testInvalidDimensionSize

  def testInvalidDimensionSize(self):
    with self.test_session(use_gpu=False) as sess:
      sp_input = self._SparseTensor_2x5x6()
      new_shape = np.array([3, 7, 5], dtype=np.int64)
      out = sparse_ops.sparse_reset_shape(sp_input, new_shape)

      with self.assertRaisesOpError("x <= y did not hold element-wise"):
        sess.run(out)
开发者ID:govindap,项目名称:tensorflow,代码行数:8,代码来源:sparse_ops_test.py

示例5: testInvalidRankNewShapeUnavaibleInGraphConstruction

  def testInvalidRankNewShapeUnavaibleInGraphConstruction(self):
    with self.test_session(use_gpu=False) as sess:
      new_shape = array_ops.placeholder(dtype=dtypes.int64)
      sp_input = self._SparseTensor_2x5x6()
      out = sparse_ops.sparse_reset_shape(sp_input, new_shape)

      with self.assertRaisesOpError("x == y did not hold element-wise"):
        sess.run(out, feed_dict={new_shape: np.array([3, 7], dtype=np.int64)})
开发者ID:govindap,项目名称:tensorflow,代码行数:8,代码来源:sparse_ops_test.py

示例6: testInvalidDimensionSizeDynamic

  def testInvalidDimensionSizeDynamic(self):
    with self.test_session(use_gpu=False) as sess:
      sp_input = self._SparseTensor_2x5x6()
      new_shape = array_ops.placeholder(dtype=dtypes.int32)
      out = sparse_ops.sparse_reset_shape(sp_input, new_shape)

      with self.assertRaisesOpError("x <= y did not hold element-wise"):
        sess.run(out, feed_dict={new_shape: [3, 7, 5]})
开发者ID:jon-sch,项目名称:tensorflow,代码行数:8,代码来源:sparse_ops_test.py

示例7: testTightBoundingBoxEmpty

  def testTightBoundingBoxEmpty(self):
    with self.test_session(use_gpu=False) as sess:
      sp_input = self._SparseTensor_2x5x6_Empty()
      sp_output = sparse_ops.sparse_reset_shape(sp_input)

      output = sess.run(sp_output)

      self.assertAllEqual(output.indices.shape, [0, 3])
      self.assertAllEqual(output.values.shape, [0])
      self.assertAllEqual(output.dense_shape, [0, 0, 0])
开发者ID:HughKu,项目名称:tensorflow,代码行数:10,代码来源:sparse_ops_test.py

示例8: testTightBoundingBoxEmpty

  def testTightBoundingBoxEmpty(self):
    with test_util.force_cpu():
      sp_input = self._SparseTensor_2x5x6_Empty()
      sp_output = sparse_ops.sparse_reset_shape(sp_input)

      output = self.evaluate(sp_output)

      self.assertAllEqual(output.indices.shape, [0, 3])
      self.assertAllEqual(output.values.shape, [0])
      self.assertAllEqual(output.dense_shape, [0, 0, 0])
开发者ID:Wajih-O,项目名称:tensorflow,代码行数:10,代码来源:sparse_ops_test.py

示例9: testTightBoundingBox

    def testTightBoundingBox(self):
        with self.test_session(use_gpu=False) as sess:
            sp_input = self._SparseTensor_2x5x6()
            sp_output = sparse_ops.sparse_reset_shape(sp_input)

            output = sess.run(sp_output)

            self.assertAllEqual(output.indices, [[0, 0, 0], [0, 1, 0], [0, 1, 3], [1, 1, 4], [1, 3, 2], [1, 3, 3]])
            self.assertAllEqual(output.values, [0, 10, 13, 14, 32, 33])
            self.assertAllEqual(output.shape, [2, 4, 5])
开发者ID:tongwang01,项目名称:tensorflow,代码行数:10,代码来源:sparse_ops_test.py

示例10: testTightBoundingBox

  def testTightBoundingBox(self):
    with test_util.force_cpu():
      sp_input = self._SparseTensor_2x5x6()
      sp_output = sparse_ops.sparse_reset_shape(sp_input)

      output = self.evaluate(sp_output)

      self.assertAllEqual(output.indices, [[0, 0, 0], [0, 1, 0], [0, 1, 3],
                                           [1, 1, 4], [1, 3, 2], [1, 3, 3]])
      self.assertAllEqual(output.values, [0, 10, 13, 14, 32, 33])
      self.assertAllEqual(output.dense_shape, [2, 4, 5])
开发者ID:Wajih-O,项目名称:tensorflow,代码行数:11,代码来源:sparse_ops_test.py

示例11: testInputUnavaibleInGraphConstructionOk

    def testInputUnavaibleInGraphConstructionOk(self):
        with self.test_session(use_gpu=False) as sess:
            sp_input = array_ops.sparse_placeholder(dtype=dtypes.int32)
            new_shape = np.array([3, 6, 7], dtype=np.int64)
            sp_output = sparse_ops.sparse_reset_shape(sp_input, new_shape)

            output = sess.run(sp_output, feed_dict={sp_input: self._SparseTensorValue_2x5x6()})

            self.assertAllEqual(output.indices, [[0, 0, 0], [0, 1, 0], [0, 1, 3], [1, 1, 4], [1, 3, 2], [1, 3, 3]])
            self.assertAllEqual(output.values, [0, 10, 13, 14, 32, 33])
            self.assertAllEqual(output.shape, [3, 6, 7])
开发者ID:tongwang01,项目名称:tensorflow,代码行数:11,代码来源:sparse_ops_test.py

示例12: testBasic

    def testBasic(self):
        with self.test_session(use_gpu=False) as sess:
            sp_input = self._SparseTensor_2x5x6()
            new_shape = np.array([3, 6, 7], dtype=np.int64)
            sp_output = sparse_ops.sparse_reset_shape(sp_input, new_shape)

            output = sess.run(sp_output)

            self.assertAllEqual(output.indices, [[0, 0, 0], [0, 1, 0], [0, 1, 3], [1, 1, 4], [1, 3, 2], [1, 3, 3]])
            self.assertAllEqual(output.values, [0, 10, 13, 14, 32, 33])
            self.assertAllEqual(output.shape, [3, 6, 7])
开发者ID:tongwang01,项目名称:tensorflow,代码行数:11,代码来源:sparse_ops_test.py

示例13: testInputUnavailableInGraphConstructionOk

  def testInputUnavailableInGraphConstructionOk(self):
    with test_util.force_cpu():
      sp_input = self._SparseTensorValue_2x5x6()
      new_shape = np.array([3, 6, 7], dtype=np.int64)
      sp_output = sparse_ops.sparse_reset_shape(sp_input, new_shape)

      output = self.evaluate(sp_output)

      self.assertAllEqual(output.indices, [[0, 0, 0], [0, 1, 0], [0, 1, 3],
                                           [1, 1, 4], [1, 3, 2], [1, 3, 3]])
      self.assertAllEqual(output.values, [0, 10, 13, 14, 32, 33])
      self.assertAllEqual(output.dense_shape, [3, 6, 7])
开发者ID:Wajih-O,项目名称:tensorflow,代码行数:12,代码来源:sparse_ops_test.py

示例14: testInvalidDimensionSizeStatic

  def testInvalidDimensionSizeStatic(self):
    sp_input = self._SparseTensor_2x5x6()
    new_shape = np.array([3, 7, 5], dtype=np.int64)

    with self.assertRaisesRegexp(ValueError, "should have dimension sizes"):
      sparse_ops.sparse_reset_shape(sp_input, new_shape)
开发者ID:jon-sch,项目名称:tensorflow,代码行数:6,代码来源:sparse_ops_test.py

示例15: testStaticShapeInfoPreservedWhenNewShapeIsProvidedAndStatic

 def testStaticShapeInfoPreservedWhenNewShapeIsProvidedAndStatic(self):
   sp_input = self._SparseTensor_2x5x6()
   new_shape = np.array([3, 6, 7], dtype=np.int64)
   sp_output = sparse_ops.sparse_reset_shape(sp_input, new_shape)
   self.assertAllEqual([3, 6, 7], sp_output.get_shape())
开发者ID:jon-sch,项目名称:tensorflow,代码行数:5,代码来源:sparse_ops_test.py


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