@@ -30,7 +30,7 @@ def test_tensor_handles_empty_sequence_with_dtype(self):
30
30
class ValueConstructorTest (unittest .TestCase ):
31
31
def test_value_minimal_creation (self ):
32
32
"""Test creating a value with just a name."""
33
- value = _constructors .value ("minimal" )
33
+ value = _constructors .val ("minimal" )
34
34
35
35
self .assertEqual (value .name , "minimal" )
36
36
self .assertIsNone (value .type )
@@ -39,7 +39,7 @@ def test_value_minimal_creation(self):
39
39
40
40
def test_value_creation_with_sequence_shape (self ):
41
41
"""Test that shape is correctly converted from sequence to Shape object."""
42
- value = _constructors .value ("test" , ir .DataType .INT32 , [1 , 2 , 3 ])
42
+ value = _constructors .val ("test" , ir .DataType .INT32 , [1 , 2 , 3 ])
43
43
44
44
self .assertEqual (value .name , "test" )
45
45
self .assertIsInstance (value .shape , ir .Shape )
@@ -48,7 +48,7 @@ def test_value_creation_with_sequence_shape(self):
48
48
def test_value_creation_with_explicit_type (self ):
49
49
"""Test value creation with explicit type parameter."""
50
50
tensor_type = ir .TensorType (ir .DataType .DOUBLE )
51
- value = _constructors .value ("y" , type = tensor_type , shape = [10 ])
51
+ value = _constructors .val ("y" , type = tensor_type , shape = [10 ])
52
52
53
53
self .assertEqual (value .name , "y" )
54
54
self .assertEqual (value .type , tensor_type )
@@ -57,7 +57,7 @@ def test_value_creation_with_explicit_type(self):
57
57
def test_value_creation_with_const_value (self ):
58
58
"""Test value creation with const_value (initializer)."""
59
59
const_tensor = ir .Tensor (np .array ([1.0 , 2.0 , 3.0 ], dtype = np .float32 ), name = "const" )
60
- value = _constructors .value ("initializer" , const_value = const_tensor )
60
+ value = _constructors .val ("initializer" , const_value = const_tensor )
61
61
62
62
self .assertEqual (value .name , "initializer" )
63
63
self .assertEqual (value .type , ir .TensorType (ir .DataType .FLOAT ))
@@ -66,7 +66,7 @@ def test_value_creation_with_const_value(self):
66
66
67
67
def test_value_creation_with_dtype_only (self ):
68
68
"""Test value creation with only dtype specified."""
69
- value = _constructors .value ("float_value" , dtype = ir .DataType .FLOAT )
69
+ value = _constructors .val ("float_value" , dtype = ir .DataType .FLOAT )
70
70
71
71
self .assertEqual (value .name , "float_value" )
72
72
self .assertEqual (value .type , ir .TensorType (ir .DataType .FLOAT ))
@@ -78,25 +78,25 @@ def test_value_const_value_type_mismatch_error(self):
78
78
wrong_type = ir .TensorType (ir .DataType .FLOAT )
79
79
80
80
with self .assertRaisesRegex (ValueError , "The type does not match the const_value" ):
81
- _constructors .value ("test" , type = wrong_type , const_value = const_tensor )
81
+ _constructors .val ("test" , type = wrong_type , const_value = const_tensor )
82
82
83
83
def test_value_const_value_dtype_mismatch_error (self ):
84
84
"""Test that providing mismatched dtype with const_value raises ValueError."""
85
85
const_tensor = ir .tensor ([1.0 , 2.0 ], dtype = ir .DataType .FLOAT )
86
86
87
87
with self .assertRaisesRegex (ValueError , "The dtype does not match the const_value" ):
88
- _constructors .value ("test" , dtype = ir .DataType .INT32 , const_value = const_tensor )
88
+ _constructors .val ("test" , dtype = ir .DataType .INT32 , const_value = const_tensor )
89
89
90
90
def test_value_const_value_shape_mismatch_error (self ):
91
91
"""Test that providing mismatched shape with const_value raises ValueError."""
92
92
const_tensor = ir .tensor ([[1 , 2 ], [3 , 4 ]], dtype = ir .DataType .INT32 ) # Shape: [2, 2]
93
93
94
94
with self .assertRaisesRegex (ValueError , "The shape does not match the const_value" ):
95
- _constructors .value ("test" , shape = [3 , 3 ], const_value = const_tensor )
95
+ _constructors .val ("test" , shape = [3 , 3 ], const_value = const_tensor )
96
96
97
97
def test_value_initialize_with_const_value (self ):
98
98
const_tensor = ir .tensor (np .array ([[1.5 , 2.5 ], [3.5 , 4.5 ]], dtype = np .float64 ))
99
- value = _constructors .value ("test" , const_value = const_tensor )
99
+ value = _constructors .val ("test" , const_value = const_tensor )
100
100
101
101
self .assertEqual (value .name , "test" )
102
102
self .assertEqual (value .type , ir .TensorType (ir .DataType .DOUBLE ))
@@ -105,14 +105,14 @@ def test_value_initialize_with_const_value(self):
105
105
106
106
def test_value_creation_with_string_dimensions (self ):
107
107
"""Test value creation with string dimensions in shape."""
108
- value = _constructors .value ("dynamic" , ir .DataType .FLOAT , ["batch" , "seq_len" , 768 ])
108
+ value = _constructors .val ("dynamic" , ir .DataType .FLOAT , ["batch" , "seq_len" , 768 ])
109
109
110
110
self .assertEqual (value .name , "dynamic" )
111
111
self .assertEqual (value .shape , ir .Shape (["batch" , "seq_len" , 768 ]))
112
112
113
113
def test_value_creation_with_none_dimensions (self ):
114
114
"""Test value creation with None dimensions in shape."""
115
- value = _constructors .value ("unknown" , ir .DataType .INT64 , [None , 10 , None ])
115
+ value = _constructors .val ("unknown" , ir .DataType .INT64 , [None , 10 , None ])
116
116
117
117
self .assertEqual (value .name , "unknown" )
118
118
self .assertEqual (value .shape , ir .Shape ([None , 10 , None ]))
0 commit comments