mirror of https://github.com/Jittor/Jittor
polish example
This commit is contained in:
parent
120057640c
commit
c5acaa2474
|
@ -146,12 +146,13 @@ struct CodeOp : Op {
|
|||
a = jt.random([10])
|
||||
b = jt.code(a.shape, a.dtype, [a],
|
||||
cpu_src='''
|
||||
LOGir << HAHAHA;
|
||||
@out0(0) = HAHAHA;
|
||||
''')
|
||||
# HAHAHA is defined in flags below
|
||||
# /any/include/path can be change to any path you want to include
|
||||
b.compile_options = {"FLAGS: -DHAHAHA=233 -I/any/include/path ": 1}
|
||||
b.sync()
|
||||
print(b[0])
|
||||
# will output 233
|
||||
|
||||
|
||||
CUDA Example-1::
|
||||
|
|
|
@ -34,9 +34,12 @@ class TestCodeOp(unittest.TestCase):
|
|||
b = jt.code(a.shape, a.dtype, [a],
|
||||
cpu_src='''
|
||||
LOGir << HAHAHA;
|
||||
@out0(0) = HAHAHA;
|
||||
''')
|
||||
b.compile_options = {"FLAGS: -DHAHAHA=233 -I/any/include/path ": 1}
|
||||
b.sync()
|
||||
# print(b[0])
|
||||
assert b[0].item() == 233
|
||||
|
||||
|
||||
|
||||
def test_use_func(self):
|
||||
|
|
Loading…
Reference in New Issue