How to use the diffusion.gauss2DNp function in diffusion

To help you get started, we’ve selected a few diffusion examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github opveclib / opveclib / opveclib / examples / test_gauss.py View on Github external
def test(self):
        """
        Creates Gauss kernels on the CPU/GPU and in numpy and compares these.
        """
        print('*** Running Test: ' + self.__class__.__name__ + ' function: ' + _getframe().f_code.co_name)
        # this test fails with mX = 9 and mY = 8 due to a bug in nvcc that needs more investigation
        # for now, skip this test to the build can pass.
        # for mY in [1, 2, 3, 8]:
        #     for mX in [1, 2, 3, 9]:
        for mY in [1, 2, 3, 9]:
            for mX in [1, 2, 3, 8]:
                print "Test case mX = %d and mY = %d." % (mX, mY) # Print parameters of the test case.
                op = Gauss2DOp(dimOut=[mY,mX], clear_cache=True)

                dataCPU = op.evaluate_c()
                dataNPY = gauss2DNp([mY,mX])
                assert np.allclose(dataCPU, dataNPY)

                if ops.local.cuda_enabled:
                    dataGPU = op.evaluate_cuda()
                    assert np.allclose(dataGPU, dataNPY)

diffusion

Python SDK for Diffusion.

MIT
Latest version published 23 days ago

Package Health Score

81 / 100
Full package analysis