Files
SDK_SG200x_V2/cviruntime/python/cvk_test.py
carbon e25f20f7a3 add cviruntime
commit 3f4938648950a7f3bf9a19c320ca9fae7c52de20
Author: sophgo-forum-service <forum_service@sophgo.com>
Date:   Mon May 13 13:44:23 2024 +0800

    [feat] cviruntime opensource for cv18xx soc.

    - a4b6a3, add cumsum and gatherelements_pt.
2024-05-31 11:51:34 +08:00

17 lines
362 B
Python

import numpy as np
import pyruntime as rt
cvk_ctx = rt.CvkContext("CviContext")
a = np.array([[[[1]]]], dtype=np.int8)
b = cvk_ctx.lmem_alloc_tensor(a, 1)
b.shapes()
b.address()
c = cvk_ctx.lmem_alloc_tensor(a, 1)
c.shapes()
c.address()
cvk_ctx.tdma_g2l_tensor_copy(b, a)
d = np.array([[[[0]]]], dtype=np.int8)
cvk_ctx.tdma_l2g_tensor_copy(d, b)
print(a == d)