99
1010 from docarray .computation .jax_backend import JaxCompBackend
1111 from docarray .typing import JaxArray
12- jax .config .update ("jax_enable_x64" , True )
12+
13+ jax .config .update ("jax_enable_x64" , True )
1314
1415
1516@pytest .mark .parametrize (
@@ -26,7 +27,6 @@ def test_n_dim(shape, result):
2627 assert JaxCompBackend .n_dim (array ) == result
2728
2829
29- @pytest .mark .tensorflow
3030@pytest .mark .parametrize (
3131 'shape,result' ,
3232 [
@@ -42,14 +42,12 @@ def test_shape(shape, result):
4242 assert type (shape ) == tuple
4343
4444
45- @pytest .mark .tensorflow
4645def test_to_device ():
4746 array = JaxArray (jnp .zeros ((3 )))
4847 array = JaxCompBackend .to_device (array , 'cpu' )
4948 assert array .tensor .device ().platform .endswith ('cpu' )
5049
5150
52- @pytest .mark .tensorflow
5351@pytest .mark .parametrize (
5452 'dtype,result_type' ,
5553 [
@@ -64,34 +62,29 @@ def test_dtype(dtype, result_type):
6462 assert JaxCompBackend .dtype (array ) == result_type
6563
6664
67- @pytest .mark .tensorflow
6865def test_empty ():
6966 array = JaxCompBackend .empty ((10 , 3 ))
7067 assert array .tensor .shape == (10 , 3 )
7168
7269
73- @pytest .mark .tensorflow
7470def test_empty_dtype ():
7571 tf_tensor = JaxCompBackend .empty ((10 , 3 ), dtype = jnp .int32 )
7672 assert tf_tensor .tensor .shape == (10 , 3 )
7773 assert tf_tensor .tensor .dtype == jnp .int32
7874
7975
80- @pytest .mark .tensorflow
8176def test_empty_device ():
8277 tensor = JaxCompBackend .empty ((10 , 3 ), device = 'cpu' )
8378 assert tensor .tensor .shape == (10 , 3 )
8479 assert tensor .tensor .device ().platform .endswith ('cpu' )
8580
8681
87- @pytest .mark .tensorflow
8882def test_squeeze ():
8983 tensor = JaxArray (jnp .zeros (shape = (1 , 1 , 3 , 1 )))
9084 squeezed = JaxCompBackend .squeeze (tensor )
9185 assert squeezed .tensor .shape == (3 ,)
9286
9387
94- @pytest .mark .tensorflow
9588@pytest .mark .parametrize (
9689 'data_input,t_range,x_range,data_result' ,
9790 [
@@ -123,14 +116,12 @@ def test_minmax_normalize(data_input, t_range, x_range, data_result):
123116 assert jnp .allclose (output .tensor , jnp .array (data_result ))
124117
125118
126- @pytest .mark .tensorflow
127119def test_reshape ():
128120 tensor = JaxArray (jnp .zeros ((3 , 224 , 224 )))
129121 reshaped = JaxCompBackend .reshape (tensor , (224 , 224 , 3 ))
130122 assert reshaped .tensor .shape == (224 , 224 , 3 )
131123
132124
133- @pytest .mark .tensorflow
134125def test_stack ():
135126 t0 = JaxArray (jnp .zeros ((3 , 224 , 224 )))
136127 t1 = JaxArray (jnp .ones ((3 , 224 , 224 )))
0 commit comments