warp-lang 1.0.0b2__py3-none-win_amd64.whl → 1.0.0b6__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of warp-lang might be problematic. Click here for more details.
- docs/conf.py +17 -5
- examples/env/env_ant.py +1 -1
- examples/env/env_cartpole.py +1 -1
- examples/env/env_humanoid.py +1 -1
- examples/env/env_usd.py +4 -1
- examples/env/environment.py +8 -9
- examples/example_dem.py +34 -33
- examples/example_diffray.py +364 -337
- examples/example_fluid.py +32 -23
- examples/example_jacobian_ik.py +97 -93
- examples/example_marching_cubes.py +6 -16
- examples/example_mesh.py +6 -16
- examples/example_mesh_intersect.py +16 -14
- examples/example_nvdb.py +14 -16
- examples/example_raycast.py +14 -13
- examples/example_raymarch.py +16 -23
- examples/example_render_opengl.py +19 -10
- examples/example_sim_cartpole.py +82 -78
- examples/example_sim_cloth.py +45 -48
- examples/example_sim_fk_grad.py +51 -44
- examples/example_sim_fk_grad_torch.py +47 -40
- examples/example_sim_grad_bounce.py +108 -133
- examples/example_sim_grad_cloth.py +99 -113
- examples/example_sim_granular.py +5 -6
- examples/{example_sim_sdf_shape.py → example_sim_granular_collision_sdf.py} +37 -26
- examples/example_sim_neo_hookean.py +51 -55
- examples/example_sim_particle_chain.py +4 -4
- examples/example_sim_quadruped.py +126 -81
- examples/example_sim_rigid_chain.py +54 -61
- examples/example_sim_rigid_contact.py +66 -70
- examples/example_sim_rigid_fem.py +3 -3
- examples/example_sim_rigid_force.py +1 -1
- examples/example_sim_rigid_gyroscopic.py +3 -4
- examples/example_sim_rigid_kinematics.py +28 -39
- examples/example_sim_trajopt.py +112 -110
- examples/example_sph.py +9 -8
- examples/example_wave.py +7 -7
- examples/fem/bsr_utils.py +30 -17
- examples/fem/example_apic_fluid.py +85 -69
- examples/fem/example_convection_diffusion.py +97 -93
- examples/fem/example_convection_diffusion_dg.py +142 -149
- examples/fem/example_convection_diffusion_dg0.py +141 -136
- examples/fem/example_deformed_geometry.py +146 -0
- examples/fem/example_diffusion.py +115 -84
- examples/fem/example_diffusion_3d.py +116 -86
- examples/fem/example_diffusion_mgpu.py +102 -79
- examples/fem/example_mixed_elasticity.py +139 -100
- examples/fem/example_navier_stokes.py +175 -162
- examples/fem/example_stokes.py +143 -111
- examples/fem/example_stokes_transfer.py +186 -157
- examples/fem/mesh_utils.py +59 -97
- examples/fem/plot_utils.py +138 -17
- tools/ci/publishing/build_nodes_info.py +54 -0
- warp/__init__.py +4 -3
- warp/__init__.pyi +1 -0
- warp/bin/warp-clang.dll +0 -0
- warp/bin/warp.dll +0 -0
- warp/build.py +5 -3
- warp/build_dll.py +29 -9
- warp/builtins.py +836 -492
- warp/codegen.py +864 -553
- warp/config.py +3 -1
- warp/context.py +389 -172
- warp/fem/__init__.py +24 -6
- warp/fem/cache.py +318 -25
- warp/fem/dirichlet.py +7 -3
- warp/fem/domain.py +14 -0
- warp/fem/field/__init__.py +30 -38
- warp/fem/field/field.py +149 -0
- warp/fem/field/nodal_field.py +244 -138
- warp/fem/field/restriction.py +8 -6
- warp/fem/field/test.py +127 -59
- warp/fem/field/trial.py +117 -60
- warp/fem/geometry/__init__.py +5 -1
- warp/fem/geometry/deformed_geometry.py +271 -0
- warp/fem/geometry/element.py +24 -1
- warp/fem/geometry/geometry.py +86 -14
- warp/fem/geometry/grid_2d.py +112 -54
- warp/fem/geometry/grid_3d.py +134 -65
- warp/fem/geometry/hexmesh.py +953 -0
- warp/fem/geometry/partition.py +85 -33
- warp/fem/geometry/quadmesh_2d.py +532 -0
- warp/fem/geometry/tetmesh.py +451 -115
- warp/fem/geometry/trimesh_2d.py +197 -92
- warp/fem/integrate.py +534 -268
- warp/fem/operator.py +58 -31
- warp/fem/polynomial.py +11 -0
- warp/fem/quadrature/__init__.py +1 -1
- warp/fem/quadrature/pic_quadrature.py +150 -58
- warp/fem/quadrature/quadrature.py +209 -57
- warp/fem/space/__init__.py +230 -53
- warp/fem/space/basis_space.py +489 -0
- warp/fem/space/collocated_function_space.py +105 -0
- warp/fem/space/dof_mapper.py +49 -2
- warp/fem/space/function_space.py +90 -39
- warp/fem/space/grid_2d_function_space.py +149 -496
- warp/fem/space/grid_3d_function_space.py +173 -538
- warp/fem/space/hexmesh_function_space.py +352 -0
- warp/fem/space/partition.py +129 -76
- warp/fem/space/quadmesh_2d_function_space.py +369 -0
- warp/fem/space/restriction.py +46 -34
- warp/fem/space/shape/__init__.py +15 -0
- warp/fem/space/shape/cube_shape_function.py +738 -0
- warp/fem/space/shape/shape_function.py +103 -0
- warp/fem/space/shape/square_shape_function.py +611 -0
- warp/fem/space/shape/tet_shape_function.py +567 -0
- warp/fem/space/shape/triangle_shape_function.py +429 -0
- warp/fem/space/tetmesh_function_space.py +132 -1039
- warp/fem/space/topology.py +295 -0
- warp/fem/space/trimesh_2d_function_space.py +104 -742
- warp/fem/types.py +13 -11
- warp/fem/utils.py +335 -60
- warp/native/array.h +120 -34
- warp/native/builtin.h +101 -72
- warp/native/bvh.cpp +73 -325
- warp/native/bvh.cu +406 -23
- warp/native/bvh.h +22 -40
- warp/native/clang/clang.cpp +1 -0
- warp/native/crt.h +2 -0
- warp/native/cuda_util.cpp +8 -3
- warp/native/cuda_util.h +1 -0
- warp/native/exports.h +1522 -1243
- warp/native/intersect.h +19 -4
- warp/native/intersect_adj.h +8 -8
- warp/native/mat.h +76 -17
- warp/native/mesh.cpp +33 -108
- warp/native/mesh.cu +114 -18
- warp/native/mesh.h +395 -40
- warp/native/noise.h +272 -329
- warp/native/quat.h +51 -8
- warp/native/rand.h +44 -34
- warp/native/reduce.cpp +1 -1
- warp/native/sparse.cpp +4 -4
- warp/native/sparse.cu +163 -155
- warp/native/spatial.h +2 -2
- warp/native/temp_buffer.h +18 -14
- warp/native/vec.h +103 -21
- warp/native/warp.cpp +2 -1
- warp/native/warp.cu +28 -3
- warp/native/warp.h +4 -3
- warp/render/render_opengl.py +261 -109
- warp/sim/__init__.py +1 -2
- warp/sim/articulation.py +385 -185
- warp/sim/import_mjcf.py +59 -48
- warp/sim/import_urdf.py +15 -15
- warp/sim/import_usd.py +174 -102
- warp/sim/inertia.py +17 -18
- warp/sim/integrator_xpbd.py +4 -3
- warp/sim/model.py +330 -250
- warp/sim/render.py +1 -1
- warp/sparse.py +625 -152
- warp/stubs.py +341 -309
- warp/tape.py +9 -6
- warp/tests/__main__.py +3 -6
- warp/tests/assets/curlnoise_golden.npy +0 -0
- warp/tests/assets/pnoise_golden.npy +0 -0
- warp/tests/{test_class_kernel.py → aux_test_class_kernel.py} +9 -1
- warp/tests/aux_test_conditional_unequal_types_kernels.py +21 -0
- warp/tests/{test_dependent.py → aux_test_dependent.py} +2 -2
- warp/tests/{test_reference.py → aux_test_reference.py} +1 -1
- warp/tests/aux_test_unresolved_func.py +14 -0
- warp/tests/aux_test_unresolved_symbol.py +14 -0
- warp/tests/disabled_kinematics.py +239 -0
- warp/tests/run_coverage_serial.py +31 -0
- warp/tests/test_adam.py +103 -106
- warp/tests/test_arithmetic.py +94 -74
- warp/tests/test_array.py +82 -101
- warp/tests/test_array_reduce.py +57 -23
- warp/tests/test_atomic.py +64 -28
- warp/tests/test_bool.py +22 -12
- warp/tests/test_builtins_resolution.py +1292 -0
- warp/tests/test_bvh.py +18 -18
- warp/tests/test_closest_point_edge_edge.py +54 -57
- warp/tests/test_codegen.py +165 -134
- warp/tests/test_compile_consts.py +28 -20
- warp/tests/test_conditional.py +108 -24
- warp/tests/test_copy.py +10 -12
- warp/tests/test_ctypes.py +112 -88
- warp/tests/test_dense.py +21 -14
- warp/tests/test_devices.py +98 -0
- warp/tests/test_dlpack.py +75 -75
- warp/tests/test_examples.py +237 -0
- warp/tests/test_fabricarray.py +22 -24
- warp/tests/test_fast_math.py +15 -11
- warp/tests/test_fem.py +1034 -124
- warp/tests/test_fp16.py +23 -16
- warp/tests/test_func.py +187 -86
- warp/tests/test_generics.py +194 -49
- warp/tests/test_grad.py +123 -181
- warp/tests/test_grad_customs.py +176 -0
- warp/tests/test_hash_grid.py +35 -34
- warp/tests/test_import.py +10 -23
- warp/tests/test_indexedarray.py +24 -25
- warp/tests/test_intersect.py +18 -9
- warp/tests/test_large.py +141 -0
- warp/tests/test_launch.py +14 -41
- warp/tests/test_lerp.py +64 -65
- warp/tests/test_lvalue.py +493 -0
- warp/tests/test_marching_cubes.py +12 -13
- warp/tests/test_mat.py +517 -2898
- warp/tests/test_mat_lite.py +115 -0
- warp/tests/test_mat_scalar_ops.py +2889 -0
- warp/tests/test_math.py +103 -9
- warp/tests/test_matmul.py +304 -69
- warp/tests/test_matmul_lite.py +410 -0
- warp/tests/test_mesh.py +60 -22
- warp/tests/test_mesh_query_aabb.py +21 -25
- warp/tests/test_mesh_query_point.py +111 -22
- warp/tests/test_mesh_query_ray.py +12 -24
- warp/tests/test_mlp.py +30 -22
- warp/tests/test_model.py +92 -89
- warp/tests/test_modules_lite.py +39 -0
- warp/tests/test_multigpu.py +88 -114
- warp/tests/test_noise.py +12 -11
- warp/tests/test_operators.py +16 -20
- warp/tests/test_options.py +11 -11
- warp/tests/test_pinned.py +17 -18
- warp/tests/test_print.py +32 -11
- warp/tests/test_quat.py +275 -129
- warp/tests/test_rand.py +18 -16
- warp/tests/test_reload.py +38 -34
- warp/tests/test_rounding.py +50 -43
- warp/tests/test_runlength_encode.py +168 -20
- warp/tests/test_smoothstep.py +9 -11
- warp/tests/test_snippet.py +143 -0
- warp/tests/test_sparse.py +261 -63
- warp/tests/test_spatial.py +276 -243
- warp/tests/test_streams.py +110 -85
- warp/tests/test_struct.py +268 -63
- warp/tests/test_tape.py +39 -21
- warp/tests/test_torch.py +90 -86
- warp/tests/test_transient_module.py +10 -12
- warp/tests/test_types.py +363 -0
- warp/tests/test_utils.py +451 -0
- warp/tests/test_vec.py +354 -2050
- warp/tests/test_vec_lite.py +73 -0
- warp/tests/test_vec_scalar_ops.py +2099 -0
- warp/tests/test_volume.py +418 -376
- warp/tests/test_volume_write.py +124 -134
- warp/tests/unittest_serial.py +35 -0
- warp/tests/unittest_suites.py +291 -0
- warp/tests/unittest_utils.py +342 -0
- warp/tests/{test_misc.py → unused_test_misc.py} +13 -5
- warp/tests/{test_debug.py → walkthough_debug.py} +3 -17
- warp/thirdparty/appdirs.py +36 -45
- warp/thirdparty/unittest_parallel.py +589 -0
- warp/types.py +622 -211
- warp/utils.py +54 -393
- warp_lang-1.0.0b6.dist-info/METADATA +238 -0
- warp_lang-1.0.0b6.dist-info/RECORD +409 -0
- {warp_lang-1.0.0b2.dist-info → warp_lang-1.0.0b6.dist-info}/WHEEL +1 -1
- examples/example_cache_management.py +0 -40
- examples/example_multigpu.py +0 -54
- examples/example_struct.py +0 -65
- examples/fem/example_stokes_transfer_3d.py +0 -210
- warp/bin/warp-clang.so +0 -0
- warp/bin/warp.so +0 -0
- warp/fem/field/discrete_field.py +0 -80
- warp/fem/space/nodal_function_space.py +0 -233
- warp/tests/test_all.py +0 -223
- warp/tests/test_array_scan.py +0 -60
- warp/tests/test_base.py +0 -208
- warp/tests/test_unresolved_func.py +0 -7
- warp/tests/test_unresolved_symbol.py +0 -7
- warp_lang-1.0.0b2.dist-info/METADATA +0 -26
- warp_lang-1.0.0b2.dist-info/RECORD +0 -380
- /warp/tests/{test_compile_consts_dummy.py → aux_test_compile_consts_dummy.py} +0 -0
- /warp/tests/{test_reference_reference.py → aux_test_reference_reference.py} +0 -0
- /warp/tests/{test_square.py → aux_test_square.py} +0 -0
- {warp_lang-1.0.0b2.dist-info → warp_lang-1.0.0b6.dist-info}/LICENSE.md +0 -0
- {warp_lang-1.0.0b2.dist-info → warp_lang-1.0.0b6.dist-info}/top_level.txt +0 -0
warp/tests/test_arithmetic.py
CHANGED
|
@@ -5,9 +5,12 @@
|
|
|
5
5
|
# distribution of this software and related documentation without an express
|
|
6
6
|
# license agreement from NVIDIA CORPORATION is strictly prohibited.
|
|
7
7
|
|
|
8
|
+
import unittest
|
|
9
|
+
|
|
8
10
|
import numpy as np
|
|
11
|
+
|
|
9
12
|
import warp as wp
|
|
10
|
-
from warp.tests.
|
|
13
|
+
from warp.tests.unittest_utils import *
|
|
11
14
|
|
|
12
15
|
wp.init()
|
|
13
16
|
|
|
@@ -34,22 +37,21 @@ np_float_types = [np.float16, np.float32, np.float64]
|
|
|
34
37
|
np_scalar_types = np_int_types + np_float_types
|
|
35
38
|
|
|
36
39
|
|
|
37
|
-
def randvals(shape, dtype):
|
|
40
|
+
def randvals(rng, shape, dtype):
|
|
38
41
|
if dtype in np_float_types:
|
|
39
|
-
return
|
|
42
|
+
return rng.standard_normal(size=shape).astype(dtype)
|
|
40
43
|
elif dtype in [np.int8, np.uint8, np.byte, np.ubyte]:
|
|
41
|
-
return
|
|
42
|
-
return
|
|
44
|
+
return rng.integers(1, high=3, size=shape, dtype=dtype)
|
|
45
|
+
return rng.integers(1, high=5, size=shape, dtype=dtype)
|
|
43
46
|
|
|
44
47
|
|
|
45
48
|
kernel_cache = dict()
|
|
46
49
|
|
|
47
50
|
|
|
48
51
|
def getkernel(func, suffix=""):
|
|
49
|
-
module = wp.get_module(func.__module__)
|
|
50
52
|
key = func.__name__ + "_" + suffix
|
|
51
53
|
if key not in kernel_cache:
|
|
52
|
-
kernel_cache[key] = wp.Kernel(func=func, key=key
|
|
54
|
+
kernel_cache[key] = wp.Kernel(func=func, key=key)
|
|
53
55
|
return kernel_cache[key]
|
|
54
56
|
|
|
55
57
|
|
|
@@ -77,7 +79,7 @@ def get_select_kernel2(dtype):
|
|
|
77
79
|
|
|
78
80
|
|
|
79
81
|
def test_arrays(test, device, dtype):
|
|
80
|
-
np.random.
|
|
82
|
+
rng = np.random.default_rng(123)
|
|
81
83
|
|
|
82
84
|
tol = {
|
|
83
85
|
np.float16: 1.0e-3,
|
|
@@ -86,14 +88,14 @@ def test_arrays(test, device, dtype):
|
|
|
86
88
|
}.get(dtype, 0)
|
|
87
89
|
|
|
88
90
|
wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
|
|
89
|
-
arr_np = randvals((10, 5), dtype)
|
|
91
|
+
arr_np = randvals(rng, (10, 5), dtype)
|
|
90
92
|
arr = wp.array(arr_np, dtype=wptype, requires_grad=True, device=device)
|
|
91
93
|
|
|
92
94
|
assert_np_equal(arr.numpy(), arr_np, tol=tol)
|
|
93
95
|
|
|
94
96
|
|
|
95
97
|
def test_unary_ops(test, device, dtype, register_kernels=False):
|
|
96
|
-
np.random.
|
|
98
|
+
rng = np.random.default_rng(123)
|
|
97
99
|
|
|
98
100
|
tol = {
|
|
99
101
|
np.float16: 5.0e-3,
|
|
@@ -128,10 +130,12 @@ def test_unary_ops(test, device, dtype, register_kernels=False):
|
|
|
128
130
|
return
|
|
129
131
|
|
|
130
132
|
if dtype in np_float_types:
|
|
131
|
-
inputs = wp.array(
|
|
133
|
+
inputs = wp.array(
|
|
134
|
+
rng.standard_normal(size=(5, 10)).astype(dtype), dtype=wptype, requires_grad=True, device=device
|
|
135
|
+
)
|
|
132
136
|
else:
|
|
133
137
|
inputs = wp.array(
|
|
134
|
-
|
|
138
|
+
rng.integers(-2, high=3, size=(5, 10), dtype=dtype), dtype=wptype, requires_grad=True, device=device
|
|
135
139
|
)
|
|
136
140
|
outputs = wp.zeros_like(inputs)
|
|
137
141
|
|
|
@@ -207,7 +211,7 @@ def test_unary_ops(test, device, dtype, register_kernels=False):
|
|
|
207
211
|
|
|
208
212
|
|
|
209
213
|
def test_nonzero(test, device, dtype, register_kernels=False):
|
|
210
|
-
np.random.
|
|
214
|
+
rng = np.random.default_rng(123)
|
|
211
215
|
|
|
212
216
|
tol = {
|
|
213
217
|
np.float16: 5.0e-3,
|
|
@@ -231,7 +235,7 @@ def test_nonzero(test, device, dtype, register_kernels=False):
|
|
|
231
235
|
if register_kernels:
|
|
232
236
|
return
|
|
233
237
|
|
|
234
|
-
inputs = wp.array(
|
|
238
|
+
inputs = wp.array(rng.integers(-2, high=3, size=10).astype(dtype), dtype=wptype, requires_grad=True, device=device)
|
|
235
239
|
outputs = wp.zeros_like(inputs)
|
|
236
240
|
|
|
237
241
|
wp.launch(kernel, dim=1, inputs=[inputs], outputs=[outputs], device=device)
|
|
@@ -253,10 +257,10 @@ def test_nonzero(test, device, dtype, register_kernels=False):
|
|
|
253
257
|
|
|
254
258
|
|
|
255
259
|
def test_binary_ops(test, device, dtype, register_kernels=False):
|
|
256
|
-
np.random.
|
|
260
|
+
rng = np.random.default_rng(123)
|
|
257
261
|
|
|
258
262
|
tol = {
|
|
259
|
-
np.float16:
|
|
263
|
+
np.float16: 5.0e-2,
|
|
260
264
|
np.float32: 1.0e-6,
|
|
261
265
|
np.float64: 1.0e-8,
|
|
262
266
|
}.get(dtype, 0)
|
|
@@ -302,11 +306,11 @@ def test_binary_ops(test, device, dtype, register_kernels=False):
|
|
|
302
306
|
if register_kernels:
|
|
303
307
|
return
|
|
304
308
|
|
|
305
|
-
vals1 = randvals([8, 10], dtype)
|
|
309
|
+
vals1 = randvals(rng, [8, 10], dtype)
|
|
306
310
|
if dtype in [np_unsigned_int_types]:
|
|
307
|
-
vals2 = vals1 + randvals([8, 10], dtype)
|
|
311
|
+
vals2 = vals1 + randvals(rng, [8, 10], dtype)
|
|
308
312
|
else:
|
|
309
|
-
vals2 = np.abs(randvals([8, 10], dtype))
|
|
313
|
+
vals2 = np.abs(randvals(rng, [8, 10], dtype))
|
|
310
314
|
|
|
311
315
|
in1 = wp.array(vals1, dtype=wptype, requires_grad=True, device=device)
|
|
312
316
|
in2 = wp.array(vals2, dtype=wptype, requires_grad=True, device=device)
|
|
@@ -458,7 +462,7 @@ def test_binary_ops(test, device, dtype, register_kernels=False):
|
|
|
458
462
|
|
|
459
463
|
|
|
460
464
|
def test_special_funcs(test, device, dtype, register_kernels=False):
|
|
461
|
-
np.random.
|
|
465
|
+
rng = np.random.default_rng(123)
|
|
462
466
|
|
|
463
467
|
tol = {
|
|
464
468
|
np.float16: 1.0e-2,
|
|
@@ -488,6 +492,7 @@ def test_special_funcs(test, device, dtype, register_kernels=False):
|
|
|
488
492
|
outputs[11, i] = wptype(2) * wp.tanh(inputs[11, i])
|
|
489
493
|
outputs[12, i] = wptype(2) * wp.acos(inputs[12, i])
|
|
490
494
|
outputs[13, i] = wptype(2) * wp.asin(inputs[13, i])
|
|
495
|
+
outputs[14, i] = wptype(2) * wp.cbrt(inputs[14, i])
|
|
491
496
|
|
|
492
497
|
kernel = getkernel(check_special_funcs, suffix=dtype.__name__)
|
|
493
498
|
output_select_kernel = get_select_kernel2(wptype)
|
|
@@ -495,8 +500,8 @@ def test_special_funcs(test, device, dtype, register_kernels=False):
|
|
|
495
500
|
if register_kernels:
|
|
496
501
|
return
|
|
497
502
|
|
|
498
|
-
invals =
|
|
499
|
-
invals[[0, 1, 2, 7]] = 0.1 + np.abs(invals[[0, 1, 2, 7]])
|
|
503
|
+
invals = rng.normal(size=(15, 10)).astype(dtype)
|
|
504
|
+
invals[[0, 1, 2, 7, 14]] = 0.1 + np.abs(invals[[0, 1, 2, 7, 14]])
|
|
500
505
|
invals[12] = np.clip(invals[12], -0.9, 0.9)
|
|
501
506
|
invals[13] = np.clip(invals[13], -0.9, 0.9)
|
|
502
507
|
inputs = wp.array(invals, dtype=wptype, requires_grad=True, device=device)
|
|
@@ -518,6 +523,7 @@ def test_special_funcs(test, device, dtype, register_kernels=False):
|
|
|
518
523
|
assert_np_equal(outputs.numpy()[11], 2 * np.tanh(inputs.numpy()[11]), tol=tol)
|
|
519
524
|
assert_np_equal(outputs.numpy()[12], 2 * np.arccos(inputs.numpy()[12]), tol=tol)
|
|
520
525
|
assert_np_equal(outputs.numpy()[13], 2 * np.arcsin(inputs.numpy()[13]), tol=tol)
|
|
526
|
+
assert_np_equal(outputs.numpy()[14], 2 * np.cbrt(inputs.numpy()[14]), tol=tol)
|
|
521
527
|
|
|
522
528
|
out = wp.zeros(1, dtype=wptype, requires_grad=True, device=device)
|
|
523
529
|
if dtype in np_float_types:
|
|
@@ -694,9 +700,22 @@ def test_special_funcs(test, device, dtype, register_kernels=False):
|
|
|
694
700
|
assert_np_equal(tape.gradients[inputs].numpy(), expected, tol=6 * tol)
|
|
695
701
|
tape.zero()
|
|
696
702
|
|
|
703
|
+
# cbrt:
|
|
704
|
+
tape = wp.Tape()
|
|
705
|
+
with tape:
|
|
706
|
+
wp.launch(kernel, dim=1, inputs=[inputs], outputs=[outputs], device=device)
|
|
707
|
+
wp.launch(output_select_kernel, dim=1, inputs=[outputs, 14, i], outputs=[out], device=device)
|
|
708
|
+
|
|
709
|
+
tape.backward(loss=out)
|
|
710
|
+
expected = np.zeros_like(inputs.numpy())
|
|
711
|
+
cbrt = np.cbrt(inputs.numpy()[14, i], dtype=np.dtype(dtype))
|
|
712
|
+
expected[14, i] = (2.0 / 3.0) * (1.0 / (cbrt * cbrt))
|
|
713
|
+
assert_np_equal(tape.gradients[inputs].numpy(), expected, tol=tol)
|
|
714
|
+
tape.zero()
|
|
715
|
+
|
|
697
716
|
|
|
698
717
|
def test_special_funcs_2arg(test, device, dtype, register_kernels=False):
|
|
699
|
-
np.random.
|
|
718
|
+
rng = np.random.default_rng(123)
|
|
700
719
|
|
|
701
720
|
tol = {
|
|
702
721
|
np.float16: 1.0e-2,
|
|
@@ -722,8 +741,8 @@ def test_special_funcs_2arg(test, device, dtype, register_kernels=False):
|
|
|
722
741
|
if register_kernels:
|
|
723
742
|
return
|
|
724
743
|
|
|
725
|
-
in1 = wp.array(np.abs(randvals([2, 10], dtype)), dtype=wptype, requires_grad=True, device=device)
|
|
726
|
-
in2 = wp.array(randvals([2, 10], dtype), dtype=wptype, requires_grad=True, device=device)
|
|
744
|
+
in1 = wp.array(np.abs(randvals(rng, [2, 10], dtype)), dtype=wptype, requires_grad=True, device=device)
|
|
745
|
+
in2 = wp.array(randvals(rng, [2, 10], dtype), dtype=wptype, requires_grad=True, device=device)
|
|
727
746
|
outputs = wp.zeros_like(in1)
|
|
728
747
|
|
|
729
748
|
wp.launch(kernel, dim=1, inputs=[in1, in2], outputs=[outputs], device=device)
|
|
@@ -763,7 +782,7 @@ def test_special_funcs_2arg(test, device, dtype, register_kernels=False):
|
|
|
763
782
|
|
|
764
783
|
|
|
765
784
|
def test_float_to_int(test, device, dtype, register_kernels=False):
|
|
766
|
-
np.random.
|
|
785
|
+
rng = np.random.default_rng(123)
|
|
767
786
|
|
|
768
787
|
tol = {
|
|
769
788
|
np.float16: 5.0e-3,
|
|
@@ -783,6 +802,7 @@ def test_float_to_int(test, device, dtype, register_kernels=False):
|
|
|
783
802
|
outputs[2, i] = wp.trunc(inputs[2, i])
|
|
784
803
|
outputs[3, i] = wp.floor(inputs[3, i])
|
|
785
804
|
outputs[4, i] = wp.ceil(inputs[4, i])
|
|
805
|
+
outputs[5, i] = wp.frac(inputs[5, i])
|
|
786
806
|
|
|
787
807
|
kernel = getkernel(check_float_to_int, suffix=dtype.__name__)
|
|
788
808
|
output_select_kernel = get_select_kernel2(wptype)
|
|
@@ -790,7 +810,7 @@ def test_float_to_int(test, device, dtype, register_kernels=False):
|
|
|
790
810
|
if register_kernels:
|
|
791
811
|
return
|
|
792
812
|
|
|
793
|
-
inputs = wp.array(
|
|
813
|
+
inputs = wp.array(rng.standard_normal(size=(6, 10)).astype(dtype), dtype=wptype, requires_grad=True, device=device)
|
|
794
814
|
outputs = wp.zeros_like(inputs)
|
|
795
815
|
|
|
796
816
|
wp.launch(kernel, dim=1, inputs=[inputs], outputs=[outputs], device=device)
|
|
@@ -800,6 +820,7 @@ def test_float_to_int(test, device, dtype, register_kernels=False):
|
|
|
800
820
|
assert_np_equal(outputs.numpy()[2], np.trunc(inputs.numpy()[2]))
|
|
801
821
|
assert_np_equal(outputs.numpy()[3], np.floor(inputs.numpy()[3]))
|
|
802
822
|
assert_np_equal(outputs.numpy()[4], np.ceil(inputs.numpy()[4]))
|
|
823
|
+
assert_np_equal(outputs.numpy()[5], np.modf(inputs.numpy()[5])[0])
|
|
803
824
|
|
|
804
825
|
# all the gradients should be zero as these functions are piecewise constant:
|
|
805
826
|
|
|
@@ -817,7 +838,7 @@ def test_float_to_int(test, device, dtype, register_kernels=False):
|
|
|
817
838
|
|
|
818
839
|
|
|
819
840
|
def test_interp(test, device, dtype, register_kernels=False):
|
|
820
|
-
np.random.
|
|
841
|
+
rng = np.random.default_rng(123)
|
|
821
842
|
|
|
822
843
|
tol = {
|
|
823
844
|
np.float16: 1.0e-2,
|
|
@@ -844,11 +865,11 @@ def test_interp(test, device, dtype, register_kernels=False):
|
|
|
844
865
|
if register_kernels:
|
|
845
866
|
return
|
|
846
867
|
|
|
847
|
-
e0 = randvals([2, 10], dtype)
|
|
848
|
-
e1 = e0 + randvals([2, 10], dtype) + 0.1
|
|
868
|
+
e0 = randvals(rng, [2, 10], dtype)
|
|
869
|
+
e1 = e0 + randvals(rng, [2, 10], dtype) + 0.1
|
|
849
870
|
in1 = wp.array(e0, dtype=wptype, requires_grad=True, device=device)
|
|
850
871
|
in2 = wp.array(e1, dtype=wptype, requires_grad=True, device=device)
|
|
851
|
-
in3 = wp.array(randvals([2, 10], dtype), dtype=wptype, requires_grad=True, device=device)
|
|
872
|
+
in3 = wp.array(randvals(rng, [2, 10], dtype), dtype=wptype, requires_grad=True, device=device)
|
|
852
873
|
|
|
853
874
|
outputs = wp.zeros_like(in1)
|
|
854
875
|
|
|
@@ -948,7 +969,7 @@ def test_interp(test, device, dtype, register_kernels=False):
|
|
|
948
969
|
|
|
949
970
|
|
|
950
971
|
def test_clamp(test, device, dtype, register_kernels=False):
|
|
951
|
-
np.random.
|
|
972
|
+
rng = np.random.default_rng(123)
|
|
952
973
|
|
|
953
974
|
tol = {
|
|
954
975
|
np.float16: 5.0e-3,
|
|
@@ -974,9 +995,9 @@ def test_clamp(test, device, dtype, register_kernels=False):
|
|
|
974
995
|
if register_kernels:
|
|
975
996
|
return
|
|
976
997
|
|
|
977
|
-
in1 = wp.array(randvals([100], dtype), dtype=wptype, requires_grad=True, device=device)
|
|
978
|
-
starts = randvals([100], dtype)
|
|
979
|
-
diffs = np.abs(randvals([100], dtype))
|
|
998
|
+
in1 = wp.array(randvals(rng, [100], dtype), dtype=wptype, requires_grad=True, device=device)
|
|
999
|
+
starts = randvals(rng, [100], dtype)
|
|
1000
|
+
diffs = np.abs(randvals(rng, [100], dtype))
|
|
980
1001
|
in2 = wp.array(starts, dtype=wptype, requires_grad=True, device=device)
|
|
981
1002
|
in3 = wp.array(starts + diffs, dtype=wptype, requires_grad=True, device=device)
|
|
982
1003
|
outputs = wp.zeros_like(in1)
|
|
@@ -1020,51 +1041,50 @@ def test_clamp(test, device, dtype, register_kernels=False):
|
|
|
1020
1041
|
tape.zero()
|
|
1021
1042
|
|
|
1022
1043
|
|
|
1023
|
-
|
|
1024
|
-
devices = get_test_devices()
|
|
1044
|
+
devices = get_test_devices()
|
|
1025
1045
|
|
|
1026
|
-
class TestArithmetic(parent):
|
|
1027
|
-
pass
|
|
1028
1046
|
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
add_function_test_register_kernel(
|
|
1032
|
-
TestArithmetic, f"test_unary_ops_{dtype.__name__}", test_unary_ops, devices=devices, dtype=dtype
|
|
1033
|
-
)
|
|
1047
|
+
class TestArithmetic(unittest.TestCase):
|
|
1048
|
+
pass
|
|
1034
1049
|
|
|
1035
|
-
for dtype in np_float_types:
|
|
1036
|
-
add_function_test_register_kernel(
|
|
1037
|
-
TestArithmetic, f"test_special_funcs_{dtype.__name__}", test_special_funcs, devices=devices, dtype=dtype
|
|
1038
|
-
)
|
|
1039
|
-
add_function_test_register_kernel(
|
|
1040
|
-
TestArithmetic,
|
|
1041
|
-
f"test_special_funcs_2arg_{dtype.__name__}",
|
|
1042
|
-
test_special_funcs_2arg,
|
|
1043
|
-
devices=devices,
|
|
1044
|
-
dtype=dtype,
|
|
1045
|
-
)
|
|
1046
|
-
add_function_test_register_kernel(
|
|
1047
|
-
TestArithmetic, f"test_interp_{dtype.__name__}", test_interp, devices=devices, dtype=dtype
|
|
1048
|
-
)
|
|
1049
|
-
add_function_test_register_kernel(
|
|
1050
|
-
TestArithmetic, f"test_float_to_int_{dtype.__name__}", test_float_to_int, devices=devices, dtype=dtype
|
|
1051
|
-
)
|
|
1052
1050
|
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
TestArithmetic, f"test_nonzero_{dtype.__name__}", test_nonzero, devices=devices, dtype=dtype
|
|
1059
|
-
)
|
|
1060
|
-
add_function_test(TestArithmetic, f"test_arrays_{dtype.__name__}", test_arrays, devices=devices, dtype=dtype)
|
|
1061
|
-
add_function_test_register_kernel(
|
|
1062
|
-
TestArithmetic, f"test_binary_ops_{dtype.__name__}", test_binary_ops, devices=devices, dtype=dtype
|
|
1063
|
-
)
|
|
1051
|
+
# these unary ops only make sense for signed values:
|
|
1052
|
+
for dtype in np_signed_int_types + np_float_types:
|
|
1053
|
+
add_function_test_register_kernel(
|
|
1054
|
+
TestArithmetic, f"test_unary_ops_{dtype.__name__}", test_unary_ops, devices=devices, dtype=dtype
|
|
1055
|
+
)
|
|
1064
1056
|
|
|
1065
|
-
|
|
1057
|
+
for dtype in np_float_types:
|
|
1058
|
+
add_function_test_register_kernel(
|
|
1059
|
+
TestArithmetic, f"test_special_funcs_{dtype.__name__}", test_special_funcs, devices=devices, dtype=dtype
|
|
1060
|
+
)
|
|
1061
|
+
add_function_test_register_kernel(
|
|
1062
|
+
TestArithmetic,
|
|
1063
|
+
f"test_special_funcs_2arg_{dtype.__name__}",
|
|
1064
|
+
test_special_funcs_2arg,
|
|
1065
|
+
devices=devices,
|
|
1066
|
+
dtype=dtype,
|
|
1067
|
+
)
|
|
1068
|
+
add_function_test_register_kernel(
|
|
1069
|
+
TestArithmetic, f"test_interp_{dtype.__name__}", test_interp, devices=devices, dtype=dtype
|
|
1070
|
+
)
|
|
1071
|
+
add_function_test_register_kernel(
|
|
1072
|
+
TestArithmetic, f"test_float_to_int_{dtype.__name__}", test_float_to_int, devices=devices, dtype=dtype
|
|
1073
|
+
)
|
|
1074
|
+
|
|
1075
|
+
for dtype in np_scalar_types:
|
|
1076
|
+
add_function_test_register_kernel(
|
|
1077
|
+
TestArithmetic, f"test_clamp_{dtype.__name__}", test_clamp, devices=devices, dtype=dtype
|
|
1078
|
+
)
|
|
1079
|
+
add_function_test_register_kernel(
|
|
1080
|
+
TestArithmetic, f"test_nonzero_{dtype.__name__}", test_nonzero, devices=devices, dtype=dtype
|
|
1081
|
+
)
|
|
1082
|
+
add_function_test(TestArithmetic, f"test_arrays_{dtype.__name__}", test_arrays, devices=devices, dtype=dtype)
|
|
1083
|
+
add_function_test_register_kernel(
|
|
1084
|
+
TestArithmetic, f"test_binary_ops_{dtype.__name__}", test_binary_ops, devices=devices, dtype=dtype
|
|
1085
|
+
)
|
|
1066
1086
|
|
|
1067
1087
|
|
|
1068
1088
|
if __name__ == "__main__":
|
|
1069
|
-
|
|
1089
|
+
wp.build.clear_kernel_cache()
|
|
1070
1090
|
unittest.main(verbosity=2, failfast=False)
|
warp/tests/test_array.py
CHANGED
|
@@ -5,14 +5,12 @@
|
|
|
5
5
|
# distribution of this software and related documentation without an express
|
|
6
6
|
# license agreement from NVIDIA CORPORATION is strictly prohibited.
|
|
7
7
|
|
|
8
|
-
import math
|
|
9
8
|
import unittest
|
|
10
9
|
|
|
11
|
-
# include parent path
|
|
12
10
|
import numpy as np
|
|
13
11
|
|
|
14
12
|
import warp as wp
|
|
15
|
-
from warp.tests.
|
|
13
|
+
from warp.tests.unittest_utils import *
|
|
16
14
|
|
|
17
15
|
wp.init()
|
|
18
16
|
|
|
@@ -1454,16 +1452,17 @@ def test_full_struct(test, device):
|
|
|
1454
1452
|
|
|
1455
1453
|
|
|
1456
1454
|
def test_round_trip(test, device):
|
|
1455
|
+
rng = np.random.default_rng(123)
|
|
1457
1456
|
dim_x = 4
|
|
1458
1457
|
|
|
1459
1458
|
for nptype, wptype in wp.types.np_dtype_to_warp_type.items():
|
|
1460
|
-
a_np =
|
|
1459
|
+
a_np = rng.standard_normal(size=dim_x).astype(nptype)
|
|
1461
1460
|
a = wp.array(a_np, device=device)
|
|
1462
1461
|
test.assertEqual(a.dtype, wptype)
|
|
1463
1462
|
|
|
1464
1463
|
assert_np_equal(a.numpy(), a_np)
|
|
1465
1464
|
|
|
1466
|
-
v_np =
|
|
1465
|
+
v_np = rng.standard_normal(size=(dim_x, 3)).astype(nptype)
|
|
1467
1466
|
v = wp.array(v_np, dtype=wp.types.vector(3, wptype), device=device)
|
|
1468
1467
|
|
|
1469
1468
|
assert_np_equal(v.numpy(), v_np)
|
|
@@ -1750,46 +1749,6 @@ def test_to_list_struct(test, device):
|
|
|
1750
1749
|
test.assertEqual(l[i].a3.ndim, s.a3.ndim)
|
|
1751
1750
|
|
|
1752
1751
|
|
|
1753
|
-
def test_large_arrays_slow(test, device):
|
|
1754
|
-
# The goal of this test is to use arrays just large enough to know
|
|
1755
|
-
# if there's a flaw in handling arrays with more than 2**31-1 elements
|
|
1756
|
-
# Unfortunately, it takes a long time to run so it won't be run automatically
|
|
1757
|
-
# without changes to support how frequently a test may be run
|
|
1758
|
-
total_elements = 2**31 + 8
|
|
1759
|
-
|
|
1760
|
-
# 1-D to 4-D arrays: test zero_, fill_, then zero_ for scalar data types:
|
|
1761
|
-
for total_dims in range(1, 5):
|
|
1762
|
-
dim_x = math.ceil(total_elements ** (1 / total_dims))
|
|
1763
|
-
shape_tuple = tuple([dim_x] * total_dims)
|
|
1764
|
-
|
|
1765
|
-
for nptype, wptype in wp.types.np_dtype_to_warp_type.items():
|
|
1766
|
-
a1 = wp.zeros(shape_tuple, dtype=wptype, device=device)
|
|
1767
|
-
assert_np_equal(a1.numpy(), np.zeros_like(a1.numpy()))
|
|
1768
|
-
|
|
1769
|
-
a1.fill_(127)
|
|
1770
|
-
assert_np_equal(a1.numpy(), 127 * np.ones_like(a1.numpy()))
|
|
1771
|
-
|
|
1772
|
-
a1.zero_()
|
|
1773
|
-
assert_np_equal(a1.numpy(), np.zeros_like(a1.numpy()))
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
def test_large_arrays_fast(test, device):
|
|
1777
|
-
# A truncated version of test_large_arrays_slow meant to catch basic errors
|
|
1778
|
-
total_elements = 2**31 + 8
|
|
1779
|
-
|
|
1780
|
-
nptype = np.dtype(np.int8)
|
|
1781
|
-
wptype = wp.types.np_dtype_to_warp_type[nptype]
|
|
1782
|
-
|
|
1783
|
-
a1 = wp.zeros((total_elements,), dtype=wptype, device=device)
|
|
1784
|
-
assert_np_equal(a1.numpy(), np.zeros_like(a1.numpy()))
|
|
1785
|
-
|
|
1786
|
-
a1.fill_(127)
|
|
1787
|
-
assert_np_equal(a1.numpy(), 127 * np.ones_like(a1.numpy()))
|
|
1788
|
-
|
|
1789
|
-
a1.zero_()
|
|
1790
|
-
assert_np_equal(a1.numpy(), np.zeros_like(a1.numpy()))
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
1752
|
@wp.kernel
|
|
1794
1753
|
def kernel_array_to_bool(array_null: wp.array(dtype=float), array_valid: wp.array(dtype=float)):
|
|
1795
1754
|
if not array_null:
|
|
@@ -2087,14 +2046,38 @@ def test_array_from_numpy(test, device):
|
|
|
2087
2046
|
result = wp.from_numpy(arr, dtype=wp.float32, shape=(32,))
|
|
2088
2047
|
expected = wp.array(
|
|
2089
2048
|
(
|
|
2090
|
-
1.0,
|
|
2091
|
-
2.0,
|
|
2092
|
-
3.0,
|
|
2093
|
-
4.0,
|
|
2094
|
-
2.0,
|
|
2095
|
-
3.0,
|
|
2096
|
-
4.0,
|
|
2097
|
-
5.0,
|
|
2049
|
+
1.0,
|
|
2050
|
+
2.0,
|
|
2051
|
+
3.0,
|
|
2052
|
+
4.0,
|
|
2053
|
+
2.0,
|
|
2054
|
+
3.0,
|
|
2055
|
+
4.0,
|
|
2056
|
+
5.0,
|
|
2057
|
+
3.0,
|
|
2058
|
+
4.0,
|
|
2059
|
+
5.0,
|
|
2060
|
+
6.0,
|
|
2061
|
+
4.0,
|
|
2062
|
+
5.0,
|
|
2063
|
+
6.0,
|
|
2064
|
+
7.0,
|
|
2065
|
+
2.0,
|
|
2066
|
+
3.0,
|
|
2067
|
+
4.0,
|
|
2068
|
+
5.0,
|
|
2069
|
+
3.0,
|
|
2070
|
+
4.0,
|
|
2071
|
+
5.0,
|
|
2072
|
+
6.0,
|
|
2073
|
+
4.0,
|
|
2074
|
+
5.0,
|
|
2075
|
+
6.0,
|
|
2076
|
+
7.0,
|
|
2077
|
+
5.0,
|
|
2078
|
+
6.0,
|
|
2079
|
+
7.0,
|
|
2080
|
+
8.0,
|
|
2098
2081
|
),
|
|
2099
2082
|
dtype=wp.float32,
|
|
2100
2083
|
shape=(32,),
|
|
@@ -2102,55 +2085,53 @@ def test_array_from_numpy(test, device):
|
|
|
2102
2085
|
assert_np_equal(result.numpy(), expected.numpy())
|
|
2103
2086
|
|
|
2104
2087
|
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
return TestArray
|
|
2088
|
+
devices = get_test_devices()
|
|
2089
|
+
|
|
2090
|
+
|
|
2091
|
+
class TestArray(unittest.TestCase):
|
|
2092
|
+
pass
|
|
2093
|
+
|
|
2094
|
+
|
|
2095
|
+
add_function_test(TestArray, "test_shape", test_shape, devices=devices)
|
|
2096
|
+
add_function_test(TestArray, "test_flatten", test_flatten, devices=devices)
|
|
2097
|
+
add_function_test(TestArray, "test_reshape", test_reshape, devices=devices)
|
|
2098
|
+
add_function_test(TestArray, "test_slicing", test_slicing, devices=devices)
|
|
2099
|
+
add_function_test(TestArray, "test_transpose", test_transpose, devices=devices)
|
|
2100
|
+
add_function_test(TestArray, "test_view", test_view, devices=devices)
|
|
2101
|
+
|
|
2102
|
+
add_function_test(TestArray, "test_1d_array", test_1d, devices=devices)
|
|
2103
|
+
add_function_test(TestArray, "test_2d_array", test_2d, devices=devices)
|
|
2104
|
+
add_function_test(TestArray, "test_3d_array", test_3d, devices=devices)
|
|
2105
|
+
add_function_test(TestArray, "test_4d_array", test_4d, devices=devices)
|
|
2106
|
+
add_function_test(TestArray, "test_4d_array_transposed", test_4d_transposed, devices=devices)
|
|
2107
|
+
|
|
2108
|
+
add_function_test(TestArray, "test_fill_scalar", test_fill_scalar, devices=devices)
|
|
2109
|
+
add_function_test(TestArray, "test_fill_vector", test_fill_vector, devices=devices)
|
|
2110
|
+
add_function_test(TestArray, "test_fill_matrix", test_fill_matrix, devices=devices)
|
|
2111
|
+
add_function_test(TestArray, "test_fill_struct", test_fill_struct, devices=devices)
|
|
2112
|
+
add_function_test(TestArray, "test_fill_slices", test_fill_slices, devices=devices)
|
|
2113
|
+
add_function_test(TestArray, "test_full_scalar", test_full_scalar, devices=devices)
|
|
2114
|
+
add_function_test(TestArray, "test_full_vector", test_full_vector, devices=devices)
|
|
2115
|
+
add_function_test(TestArray, "test_full_matrix", test_full_matrix, devices=devices)
|
|
2116
|
+
add_function_test(TestArray, "test_full_struct", test_full_struct, devices=devices)
|
|
2117
|
+
add_function_test(TestArray, "test_empty_array", test_empty_array, devices=devices)
|
|
2118
|
+
add_function_test(TestArray, "test_empty_from_numpy", test_empty_from_numpy, devices=devices)
|
|
2119
|
+
add_function_test(TestArray, "test_empty_from_list", test_empty_from_list, devices=devices)
|
|
2120
|
+
add_function_test(TestArray, "test_to_list_scalar", test_to_list_scalar, devices=devices)
|
|
2121
|
+
add_function_test(TestArray, "test_to_list_vector", test_to_list_vector, devices=devices)
|
|
2122
|
+
add_function_test(TestArray, "test_to_list_matrix", test_to_list_matrix, devices=devices)
|
|
2123
|
+
add_function_test(TestArray, "test_to_list_struct", test_to_list_struct, devices=devices)
|
|
2124
|
+
|
|
2125
|
+
add_function_test(TestArray, "test_lower_bound", test_lower_bound, devices=devices)
|
|
2126
|
+
add_function_test(TestArray, "test_round_trip", test_round_trip, devices=devices)
|
|
2127
|
+
add_function_test(TestArray, "test_array_to_bool", test_array_to_bool, devices=devices)
|
|
2128
|
+
add_function_test(TestArray, "test_array_of_structs", test_array_of_structs, devices=devices)
|
|
2129
|
+
add_function_test(TestArray, "test_array_of_structs_grad", test_array_of_structs_grad, devices=devices)
|
|
2130
|
+
add_function_test(TestArray, "test_array_of_structs_from_numpy", test_array_of_structs_from_numpy, devices=devices)
|
|
2131
|
+
add_function_test(TestArray, "test_array_of_structs_roundtrip", test_array_of_structs_roundtrip, devices=devices)
|
|
2132
|
+
add_function_test(TestArray, "test_array_from_numpy", test_array_from_numpy, devices=devices)
|
|
2152
2133
|
|
|
2153
2134
|
|
|
2154
2135
|
if __name__ == "__main__":
|
|
2155
|
-
|
|
2136
|
+
wp.build.clear_kernel_cache()
|
|
2156
2137
|
unittest.main(verbosity=2)
|