Example #1
0
  def test_trace(self):
    devnull = open(os.devnull, 'w')
    with RedirectStdStreams(stdout = devnull, stderr = devnull):
      t1 = expr.randn(100, 100)
      t2 = expr.randn(200, 100)
      t3 = expr.add(t1, t2)
      t4 = expr.randn(300, 100)
      t5 = expr.add(t3, t4)
      t6 = expr.randn(400, 100)
      t7 = expr.add(t6, t5)
      t8 = t7.optimized()
      try:
        t8.force()
      except Exception as e:
        pass

      t1 = expr.randn(100, 100)
      t2 = expr.randn(100, 100)
      t3 = expr.dot(t1, t2)
      t4 = expr.randn(200, 100)
      t5 = expr.add(t3, t4)
      t6 = t5.optimized()
      try:
        t6.force()
      except Exception as e:
        pass

      t1 = expr.randn(100, 100)
      t2 = expr.randn(100, 100)
      t3 = expr.add(t1, t2)
      t4 = expr.randn(200, 100)
      t5 = expr.add(t3, t4)
      t6 = expr.randn(100, 100)
      t7 = expr.add(t6, t5)
      t8 = expr.count_zero(t7)
      t9 = t8.optimized()
      try:
        t9.force()
      except Exception as e:
        pass
Example #2
0
    def test_trace(self):
        devnull = open(os.devnull, 'w')
        with RedirectStdStreams(stdout=devnull, stderr=devnull):
            t1 = expr.randn(100, 100)
            t2 = expr.randn(200, 100)
            t3 = expr.add(t1, t2)
            t4 = expr.randn(300, 100)
            t5 = expr.add(t3, t4)
            t6 = expr.randn(400, 100)
            t7 = expr.add(t6, t5)
            t8 = t7.optimized()
            try:
                t8.force()
            except Exception as e:
                pass

            t1 = expr.randn(100, 100)
            t2 = expr.randn(100, 100)
            t3 = expr.dot(t1, t2)
            t4 = expr.randn(200, 100)
            t5 = expr.add(t3, t4)
            t6 = t5.optimized()
            try:
                t6.force()
            except Exception as e:
                pass

            t1 = expr.randn(100, 100)
            t2 = expr.randn(100, 100)
            t3 = expr.add(t1, t2)
            t4 = expr.randn(200, 100)
            t5 = expr.add(t3, t4)
            t6 = expr.randn(100, 100)
            t7 = expr.add(t6, t5)
            t8 = expr.count_zero(t7)
            t9 = t8.optimized()
            try:
                t9.force()
            except Exception as e:
                pass
Example #3
0
 def test_count_zero(self):
     x = expr.ones((TEST_SIZE, ))
     Assert.eq(expr.count_zero(x).glom(), 0)
     x = expr.zeros((TEST_SIZE, ))
     Assert.eq(expr.count_zero(x).glom(), TEST_SIZE)
Example #4
0
 def test_count_zero(self):
   x = expr.ones((TEST_SIZE,))
   Assert.eq(expr.count_zero(x).glom(), 0)
   x = expr.zeros((TEST_SIZE,))
   Assert.eq(expr.count_zero(x).glom(), TEST_SIZE)