bigdl-core-npu 2.6.0b20241117__cp310-cp310-win_amd64.whl → 2.6.0b20241118__cp310-cp310-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.
- {bigdl_core_npu-2.6.0b20241117.dist-info → bigdl_core_npu-2.6.0b20241118.dist-info}/METADATA +1 -1
- {bigdl_core_npu-2.6.0b20241117.dist-info → bigdl_core_npu-2.6.0b20241118.dist-info}/RECORD +10 -10
- intel_npu_acceleration_library/_version.py +1 -1
- intel_npu_acceleration_library/backend/bindings.py +28 -3
- intel_npu_acceleration_library/backend/factory.py +75 -22
- intel_npu_acceleration_library/backend/ops.py +2 -1
- intel_npu_acceleration_library/backend/tensor.py +4 -3
- intel_npu_acceleration_library/lib/Release/intel_npu_acceleration_library.dll +0 -0
- {bigdl_core_npu-2.6.0b20241117.dist-info → bigdl_core_npu-2.6.0b20241118.dist-info}/WHEEL +0 -0
- {bigdl_core_npu-2.6.0b20241117.dist-info → bigdl_core_npu-2.6.0b20241118.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
intel_npu_acceleration_library/__init__.py,sha256=ZKTIhGMDjF7P6pF-yX8KWcSXbeHWRk24AO_orsa18f8,536
|
2
|
-
intel_npu_acceleration_library/_version.py,sha256=
|
2
|
+
intel_npu_acceleration_library/_version.py,sha256=irQJohc3KFxvKBKCL8Lkw8VSyeUK_28o0EIhT0xLrH0,112
|
3
3
|
intel_npu_acceleration_library/compiler.py,sha256=3IdgqjamSC8MLexDBJypIeZRiWIcTFnvQSU1LPXUr7Y,6225
|
4
4
|
intel_npu_acceleration_library/device.py,sha256=9bn8eVXJa5cXIqgfLsQAdkMVtVUQABb8z0-mQik5jRg,7424
|
5
5
|
intel_npu_acceleration_library/dtypes.py,sha256=gdd06Wsc9zIZFHlauUEx4xcK9WGTn1Mu6GkuYDJeA-E,4683
|
@@ -8,19 +8,19 @@ intel_npu_acceleration_library/optimizations.py,sha256=9NY8QoDFbs2LY12jbx6As8g2v
|
|
8
8
|
intel_npu_acceleration_library/quantization.py,sha256=6N_04h1KX6TNbw-ceANV0Pmk4_lQ2Y9C7Pwn5x-zQzo,5566
|
9
9
|
intel_npu_acceleration_library/backend/__init__.py,sha256=2NP6Ypr1dGUNXmLGW5GD9xrh0U9KJgqxTd_c7su1RUY,857
|
10
10
|
intel_npu_acceleration_library/backend/base.py,sha256=hbHqxSOfWH5BaA5PY6_zaf1Zdg5NrQK6WOfe-hr279k,8605
|
11
|
-
intel_npu_acceleration_library/backend/bindings.py,sha256=
|
11
|
+
intel_npu_acceleration_library/backend/bindings.py,sha256=6APMmDZnYBwsjcZIO5bgFz8IwfhR4CH1evWWc2IylwM,10005
|
12
12
|
intel_npu_acceleration_library/backend/compression.py,sha256=Avz_zm2s_ELy5peVQ8zFGn8njBfh9nEGR16mflotBic,630
|
13
13
|
intel_npu_acceleration_library/backend/convolution.py,sha256=cN3k78X3Y4Cbf7er-MFq0sJ4OwIvquj8PajpdEDmCo4,2018
|
14
|
-
intel_npu_acceleration_library/backend/factory.py,sha256=
|
14
|
+
intel_npu_acceleration_library/backend/factory.py,sha256=5NQyfBxjc0lkFrzmzwDSy6q7K-W78uTpGoWWfUDJGjg,40953
|
15
15
|
intel_npu_acceleration_library/backend/linear.py,sha256=RiLUh5FOSxRWHB5kYx7mOPOOrS_vxIeBJ5t3yC6wOiQ,1908
|
16
16
|
intel_npu_acceleration_library/backend/matmul.py,sha256=mfGi73-mIbUcXp4kyvCGW0Y9kb4Xp1ppbGNpdJFohuA,1819
|
17
17
|
intel_npu_acceleration_library/backend/mlp.py,sha256=BuKVwSI726v3nHQQvtMBbXyWxRTq-WoLZtTxeSeWaaY,2330
|
18
|
-
intel_npu_acceleration_library/backend/ops.py,sha256=
|
18
|
+
intel_npu_acceleration_library/backend/ops.py,sha256=3yS-f-VPErHFt_oWZrgplNmSWnRrjm_wdxXNsqEBN7M,5070
|
19
19
|
intel_npu_acceleration_library/backend/qlinear.py,sha256=oeawOjRBA_kQRqfQ1Vn_e3aJQa2b4pQ8y0gMwvHBTzk,2362
|
20
20
|
intel_npu_acceleration_library/backend/qmatmul.py,sha256=pJkFJaBxZk3Oh5w_f6ywRNeGOfloEOCj0mCGnvim9Ew,2250
|
21
21
|
intel_npu_acceleration_library/backend/runtime.py,sha256=COsTslfHknjrix4kETlnKvEmLO2lyBtXpAzEQTZJSvk,7195
|
22
22
|
intel_npu_acceleration_library/backend/sdpa.py,sha256=HNlL9jEA9OH3KnZqOkLcaKwt8tfCe5apUQxlWw0UhlA,3818
|
23
|
-
intel_npu_acceleration_library/backend/tensor.py,sha256=
|
23
|
+
intel_npu_acceleration_library/backend/tensor.py,sha256=swTymMVcXLPFXOlo6b_H3VGO1xf76Fz30RKyJPrVhPY,35468
|
24
24
|
intel_npu_acceleration_library/backend/utils.py,sha256=WJ2agtqYxBuDd21ngE55io9VX-MOGg-AjnE63UHpCiU,2174
|
25
25
|
intel_npu_acceleration_library/external/openvino/__init__.py,sha256=is1yO5Cdjdykxfhk7CnsU7w-pcn2iaIcmTLktjQPAT0,2254
|
26
26
|
intel_npu_acceleration_library/external/openvino/_pyopenvino.cp310-win_amd64.pyd,sha256=N_bRmYtuWUocGX7sl4A7nmjX19w1QyEWuHsKxbUKEGc,3376096
|
@@ -196,7 +196,7 @@ intel_npu_acceleration_library/external/openvino/torch/__init__.py,sha256=RXLzsf
|
|
196
196
|
intel_npu_acceleration_library/functional/__init__.py,sha256=WWKwKOh6Sgovv7mKctA872TbLP98Pg5m5-MREvUmlAA,204
|
197
197
|
intel_npu_acceleration_library/functional/scaled_dot_product_attention.py,sha256=yGUcg4tDQOLuUnP1g74cl-ec8TRr2SuAMcNLlN6qLvE,1620
|
198
198
|
intel_npu_acceleration_library/lib/Release/cache.json,sha256=CyrSqZUWo0Ec4_7ydOiuKIC0Gm8AybrGdozUqUuHxBw,8840377
|
199
|
-
intel_npu_acceleration_library/lib/Release/intel_npu_acceleration_library.dll,sha256=
|
199
|
+
intel_npu_acceleration_library/lib/Release/intel_npu_acceleration_library.dll,sha256=UQD_CUlEx-LGsl1CV6dNZgSk0xFzswdVJB7oBhCBSYg,332800
|
200
200
|
intel_npu_acceleration_library/lib/Release/openvino.dll,sha256=faNybSE2qCTi0EiAAnPlxHqr3WU0RI9lMDhuDwPNWlk,13090280
|
201
201
|
intel_npu_acceleration_library/lib/Release/openvino_auto_batch_plugin.dll,sha256=Pqg45nRmDeOo8qkvZdwuHxCc109-AvzTwH6ow_LF6bI,198120
|
202
202
|
intel_npu_acceleration_library/lib/Release/openvino_auto_plugin.dll,sha256=auHJGs1XwZgyo46Ze-Cg7CDstaQRK6e_uBNZAMqx3F0,473576
|
@@ -227,7 +227,7 @@ intel_npu_acceleration_library/nn/functional.py,sha256=UfAKBc0u6RtyaMo14ldH2GpEn
|
|
227
227
|
intel_npu_acceleration_library/nn/linear.py,sha256=Q06SoGQeLaI86nA_ky2GnFC6H2Fw1zyMDILKnpYC2eo,5739
|
228
228
|
intel_npu_acceleration_library/nn/llm.py,sha256=P6dz36Yf6BHtzWcftaghC6QaMI_WeRfQwrCbO7fD6hk,15002
|
229
229
|
intel_npu_acceleration_library/nn/module.py,sha256=EYxoTq6I_YgBDgTF76GPDxHrT8SupOTDGMzQaomBeq8,12667
|
230
|
-
bigdl_core_npu-2.6.
|
231
|
-
bigdl_core_npu-2.6.
|
232
|
-
bigdl_core_npu-2.6.
|
233
|
-
bigdl_core_npu-2.6.
|
230
|
+
bigdl_core_npu-2.6.0b20241118.dist-info/METADATA,sha256=CKr80VzsJrqtqLYza-vQPcFOM67iQa5LgL1jaesCAJA,1543
|
231
|
+
bigdl_core_npu-2.6.0b20241118.dist-info/WHEEL,sha256=zH8lgyF2gFod6lpCM_fWcr62DERZcd3iX2BoPN2-YV0,101
|
232
|
+
bigdl_core_npu-2.6.0b20241118.dist-info/top_level.txt,sha256=CH3qQoleRBC1eThu8mCEMxYNKdzJuXCtmeCXRKskt7A,31
|
233
|
+
bigdl_core_npu-2.6.0b20241118.dist-info/RECORD,,
|
@@ -116,15 +116,18 @@ def init_network_factory(lib: ctypes.CDLL):
|
|
116
116
|
|
117
117
|
lib.setNNFactoryWeights.argtypes = [handler, ctypes.c_int, handler, ctypes.c_bool]
|
118
118
|
|
119
|
-
lib.op_shape_size.argtypes = [handler]
|
119
|
+
lib.op_shape_size.argtypes = [handler, ctypes.c_int]
|
120
120
|
lib.op_shape_size.restype = ctypes.c_int
|
121
121
|
|
122
|
-
lib.op_shape.argtypes = [handler, ctypes.c_int]
|
122
|
+
lib.op_shape.argtypes = [handler, ctypes.c_int, ctypes.c_int]
|
123
123
|
lib.op_shape.restype = ctypes.c_int
|
124
124
|
|
125
|
-
lib.op_dtype.argtypes = [handler]
|
125
|
+
lib.op_dtype.argtypes = [handler, ctypes.c_int]
|
126
126
|
lib.op_dtype.restype = ctypes.c_int
|
127
127
|
|
128
|
+
lib.op_output_size.argtypes = [handler]
|
129
|
+
lib.op_output_size.restype = ctypes.c_int
|
130
|
+
|
128
131
|
lib.parameter.argtypes = [handler, ctypes.c_int, c_u32_array, ctypes.c_char_p]
|
129
132
|
lib.parameter.restype = handler
|
130
133
|
|
@@ -243,6 +246,15 @@ def init_network_factory(lib: ctypes.CDLL):
|
|
243
246
|
]
|
244
247
|
lib.multi_concat.restype = handler
|
245
248
|
|
249
|
+
lib.variadic_split.argtypes = [
|
250
|
+
handler,
|
251
|
+
handler,
|
252
|
+
ctypes.c_int,
|
253
|
+
c_u32_array,
|
254
|
+
ctypes.c_int,
|
255
|
+
]
|
256
|
+
lib.variadic_split.restype = handler
|
257
|
+
|
246
258
|
lib.dq_split_linear.argtypes = [
|
247
259
|
handler,
|
248
260
|
handler,
|
@@ -269,6 +281,19 @@ def init_network_factory(lib: ctypes.CDLL):
|
|
269
281
|
]
|
270
282
|
lib.dq_split_linear_prefill.restype = handler
|
271
283
|
|
284
|
+
lib.gw_linear_prefill.argtypes = [
|
285
|
+
handler,
|
286
|
+
handler,
|
287
|
+
ctypes.c_int,
|
288
|
+
ctypes.c_int,
|
289
|
+
ctypes.c_int,
|
290
|
+
ctypes.c_bool,
|
291
|
+
ctypes.c_char_p,
|
292
|
+
ctypes.c_char_p,
|
293
|
+
ctypes.c_bool,
|
294
|
+
]
|
295
|
+
lib.gw_linear_prefill.restype = handler
|
296
|
+
|
272
297
|
for op in get_supported_ops():
|
273
298
|
fn = getattr(lib, op.name)
|
274
299
|
fn.argtypes = [handler] * (op.inputs + 1) + list(op.parameters)
|
@@ -71,17 +71,24 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
71
71
|
Tensor: Tensor object
|
72
72
|
"""
|
73
73
|
# Convert Tensor objects to their underlying node
|
74
|
-
args = tuple(arg.node if isinstance(arg, Tensor) else arg for arg in args)
|
75
74
|
kwargs = {
|
76
75
|
k: v.node if isinstance(v, Tensor) else v for k, v in kwargs.items()
|
77
76
|
}
|
78
77
|
|
78
|
+
if fn.__qualname__ == 'NNFactory.reshape':
|
79
|
+
output_idx = args[0].output_idx
|
80
|
+
kwargs["output_idx"] = output_idx
|
81
|
+
args = tuple(arg.node if isinstance(arg, Tensor) else arg for arg in args)
|
82
|
+
|
83
|
+
|
79
84
|
input_nodes = [arg for arg in args if isinstance(arg, ctypes._Pointer)] + [
|
80
85
|
v for v in kwargs.values() if isinstance(v, ctypes._Pointer)
|
81
86
|
]
|
82
87
|
# Call the function
|
83
88
|
node = fn(self, *args, **kwargs)
|
84
89
|
|
90
|
+
output_len = backend_lib.op_output_size(node)
|
91
|
+
|
85
92
|
# remove input nodes from output_nodes
|
86
93
|
self.output_nodes = [
|
87
94
|
node for node in self.output_nodes if node not in input_nodes
|
@@ -91,7 +98,13 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
91
98
|
self.output_nodes.append(node)
|
92
99
|
|
93
100
|
# Wrap the node in a Tensor object
|
94
|
-
|
101
|
+
if output_len == 1:
|
102
|
+
return Tensor(factory=self, node=node, output_idx=0)
|
103
|
+
else:
|
104
|
+
output_tensor_list = []
|
105
|
+
for i in range(output_len):
|
106
|
+
output_tensor_list.append(Tensor(factory=self, node=node, output_idx=i))
|
107
|
+
return output_tensor_list
|
95
108
|
|
96
109
|
return cast(F, wrapper)
|
97
110
|
|
@@ -398,6 +411,7 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
398
411
|
wt_dtype: npt.DTypeLike = np.float16,
|
399
412
|
scale_factor: bool = True,
|
400
413
|
is_prefill: bool = False,
|
414
|
+
use_dq: bool = True,
|
401
415
|
) -> ctypes._Pointer:
|
402
416
|
"""Generate a linear layer for dynamic quantization linear layer.
|
403
417
|
|
@@ -415,7 +429,10 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
415
429
|
Returns:
|
416
430
|
ctypes._Pointer: output node
|
417
431
|
"""
|
418
|
-
|
432
|
+
if is_prefill:
|
433
|
+
func = backend_lib.dq_split_linear_prefill if use_dq else backend_lib.gw_linear_prefill
|
434
|
+
else:
|
435
|
+
func = backend_lib.dq_split_linear
|
419
436
|
return func(self._mm, input_node, n_splits,
|
420
437
|
input_channels, outout_channels, bias,
|
421
438
|
self.get_backend_dtype(act_dtype),
|
@@ -424,7 +441,9 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
424
441
|
|
425
442
|
@return_tensor
|
426
443
|
def reshape(
|
427
|
-
self, input_node: ctypes._Pointer, shape: Sequence[int]
|
444
|
+
self, input_node: ctypes._Pointer, shape: Sequence[int],
|
445
|
+
special_zero: bool = True,
|
446
|
+
output_idx: int = 0
|
428
447
|
) -> ctypes._Pointer:
|
429
448
|
"""Generate a reshape layer.
|
430
449
|
|
@@ -436,7 +455,8 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
436
455
|
ctypes._Pointer: output node
|
437
456
|
"""
|
438
457
|
shape_node = self.constant(shape).node # type: ignore
|
439
|
-
return backend_lib.reshape(self._mm, input_node, shape_node
|
458
|
+
return backend_lib.reshape(self._mm, input_node, shape_node,
|
459
|
+
special_zero, output_idx)
|
440
460
|
|
441
461
|
@return_tensor
|
442
462
|
def broadcast(
|
@@ -588,7 +608,7 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
588
608
|
ctypes._Pointer: output node
|
589
609
|
"""
|
590
610
|
if axis < 0:
|
591
|
-
shape_size = backend_lib.op_shape_size(input_node_1)
|
611
|
+
shape_size = backend_lib.op_shape_size(input_node_1, 0)
|
592
612
|
axis = (axis + shape_size) % shape_size
|
593
613
|
axis = np.int64(axis)
|
594
614
|
return backend_lib.concat(self._mm, input_node_1, input_node_2, axis)
|
@@ -607,7 +627,7 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
607
627
|
ctypes._Pointer: output node
|
608
628
|
"""
|
609
629
|
if axis < 0:
|
610
|
-
shape_size = backend_lib.op_shape_size(input_nodes[0])
|
630
|
+
shape_size = backend_lib.op_shape_size(input_nodes[0], 0)
|
611
631
|
axis = (axis + shape_size) % shape_size
|
612
632
|
axis = np.int64(axis)
|
613
633
|
|
@@ -632,7 +652,7 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
632
652
|
ctypes._Pointer: output node
|
633
653
|
"""
|
634
654
|
if reduction_axes is None:
|
635
|
-
shape_size = backend_lib.op_shape_size(input_node)
|
655
|
+
shape_size = backend_lib.op_shape_size(input_node, 0)
|
636
656
|
reduction_axes = list(range(shape_size - 1, -1, -1))
|
637
657
|
axis_node = self.constant(reduction_axes).node # type: ignore
|
638
658
|
return backend_lib.reduce_max(self._mm, input_node, axis_node, keep_dims)
|
@@ -655,7 +675,7 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
655
675
|
ctypes._Pointer: output node
|
656
676
|
"""
|
657
677
|
if reduction_axes is None:
|
658
|
-
shape_size = backend_lib.op_shape_size(input_node)
|
678
|
+
shape_size = backend_lib.op_shape_size(input_node, 0)
|
659
679
|
reduction_axes = list(range(shape_size - 1, -1, -1))
|
660
680
|
axis_node = self.constant(reduction_axes).node # type: ignore
|
661
681
|
return backend_lib.reduce_mean(self._mm, input_node, axis_node, keep_dims)
|
@@ -678,7 +698,7 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
678
698
|
ctypes._Pointer: output node
|
679
699
|
"""
|
680
700
|
if reduction_axes is None:
|
681
|
-
shape_size = backend_lib.op_shape_size(input_node)
|
701
|
+
shape_size = backend_lib.op_shape_size(input_node, 0)
|
682
702
|
reduction_axes = list(range(shape_size - 1, -1, -1))
|
683
703
|
axis_node = self.constant(reduction_axes).node # type: ignore
|
684
704
|
return backend_lib.reduce_min(self._mm, input_node, axis_node, keep_dims)
|
@@ -701,7 +721,7 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
701
721
|
ctypes._Pointer: output node
|
702
722
|
"""
|
703
723
|
if reduction_axes is None:
|
704
|
-
shape_size = backend_lib.op_shape_size(input_node)
|
724
|
+
shape_size = backend_lib.op_shape_size(input_node, 0)
|
705
725
|
reduction_axes = list(range(shape_size - 1, -1, -1))
|
706
726
|
axis_node = self.constant(reduction_axes).node # type: ignore
|
707
727
|
return backend_lib.reduce_prod(self._mm, input_node, axis_node, keep_dims)
|
@@ -724,7 +744,7 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
724
744
|
ctypes._Pointer: output node
|
725
745
|
"""
|
726
746
|
if reduction_axes is None:
|
727
|
-
shape_size = backend_lib.op_shape_size(input_node)
|
747
|
+
shape_size = backend_lib.op_shape_size(input_node, 0)
|
728
748
|
reduction_axes = list(range(shape_size - 1, -1, -1))
|
729
749
|
axis_node = self.constant(reduction_axes).node # type: ignore
|
730
750
|
return backend_lib.reduce_sum(self._mm, input_node, axis_node, keep_dims)
|
@@ -744,7 +764,7 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
744
764
|
ctypes._Pointer: output node
|
745
765
|
"""
|
746
766
|
if axis < 0:
|
747
|
-
shape_size = backend_lib.op_shape_size(input_node)
|
767
|
+
shape_size = backend_lib.op_shape_size(input_node, 0)
|
748
768
|
axis = (axis + shape_size) % shape_size
|
749
769
|
axis_node = self.constant(axis).node # type: ignore
|
750
770
|
return backend_lib.normL2(self._mm, input_node, axis_node, eps)
|
@@ -767,14 +787,14 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
767
787
|
Returns:
|
768
788
|
ctypes._Pointer: output node
|
769
789
|
"""
|
770
|
-
input_shape_size = backend_lib.op_shape_size(input_node)
|
790
|
+
input_shape_size = backend_lib.op_shape_size(input_node, 0)
|
771
791
|
input_shape = [
|
772
|
-
backend_lib.op_shape(input_node, i) for i in range(input_shape_size)
|
792
|
+
backend_lib.op_shape(input_node, i, 0) for i in range(input_shape_size)
|
773
793
|
]
|
774
794
|
if isinstance(exponent, ctypes._Pointer):
|
775
|
-
exponent_shape_size = backend_lib.op_shape_size(input_node)
|
795
|
+
exponent_shape_size = backend_lib.op_shape_size(input_node, 0)
|
776
796
|
exponent_shape = [
|
777
|
-
backend_lib.op_shape(exponent, i) for i in range(exponent_shape_size)
|
797
|
+
backend_lib.op_shape(exponent, i, 0) for i in range(exponent_shape_size)
|
778
798
|
]
|
779
799
|
else:
|
780
800
|
exponent_shape = list(exponent.shape)
|
@@ -783,6 +803,39 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
783
803
|
# raise ValueError("Input tensor shapes are not equal")
|
784
804
|
|
785
805
|
return backend_lib.power(self._mm, input_node, exponent)
|
806
|
+
|
807
|
+
@return_tensor
|
808
|
+
def variadic_split(
|
809
|
+
self,
|
810
|
+
input: ctypes._Pointer,
|
811
|
+
axis: int,
|
812
|
+
split_lengths: Sequence[int],
|
813
|
+
) -> ctypes._Pointer:
|
814
|
+
"""Generate an average pooling layer.
|
815
|
+
|
816
|
+
Args:
|
817
|
+
input (ctypes._Pointer): layer input node
|
818
|
+
axis (int): split axis
|
819
|
+
split_lengths (Sequence[int]): A list containing the sizes of each output tensor
|
820
|
+
along the split "axis". Size of "split_lengths" should be equal to the number of
|
821
|
+
outputs. The sum of split_lengths must match data.shape[axis]
|
822
|
+
|
823
|
+
Raises:
|
824
|
+
NotImplementedError: divisor_override is not supported
|
825
|
+
|
826
|
+
Returns:
|
827
|
+
ctypes._Pointer: output node
|
828
|
+
"""
|
829
|
+
|
830
|
+
split_lens_ptr = np.array(split_lengths, dtype=np.uint32)
|
831
|
+
|
832
|
+
return backend_lib.variadic_split(
|
833
|
+
self._mm,
|
834
|
+
input,
|
835
|
+
axis,
|
836
|
+
split_lens_ptr,
|
837
|
+
split_lens_ptr.size,
|
838
|
+
)
|
786
839
|
|
787
840
|
@return_tensor
|
788
841
|
def avg_pooling(
|
@@ -938,7 +991,7 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
938
991
|
value, attn_mask,
|
939
992
|
is_causal)
|
940
993
|
|
941
|
-
def get_tensor_shape(self, node):
|
994
|
+
def get_tensor_shape(self, node, output_idx=0):
|
942
995
|
"""Get tensor shape.
|
943
996
|
|
944
997
|
Args:
|
@@ -947,10 +1000,10 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
947
1000
|
Returns:
|
948
1001
|
tuple[int]: tensor shape
|
949
1002
|
"""
|
950
|
-
size = backend_lib.op_shape_size(node)
|
951
|
-
return tuple([backend_lib.op_shape(node, idx) for idx in range(size)])
|
1003
|
+
size = backend_lib.op_shape_size(node, output_idx)
|
1004
|
+
return tuple([backend_lib.op_shape(node, idx, output_idx) for idx in range(size)])
|
952
1005
|
|
953
|
-
def get_tensor_dtype(self, node):
|
1006
|
+
def get_tensor_dtype(self, node, output_idx=0):
|
954
1007
|
"""Get tensor dtype.
|
955
1008
|
|
956
1009
|
Args:
|
@@ -962,7 +1015,7 @@ class NNFactory(BaseNPUBackendWithPrefetch):
|
|
962
1015
|
Returns:
|
963
1016
|
str: tensor dtype
|
964
1017
|
"""
|
965
|
-
dtype_int = backend_lib.op_dtype(node)
|
1018
|
+
dtype_int = backend_lib.op_dtype(node, output_idx)
|
966
1019
|
|
967
1020
|
if dtype_int == 2:
|
968
1021
|
return np.bool
|
@@ -98,7 +98,7 @@ def get_supported_ops() -> List[SupportedOp]:
|
|
98
98
|
inputs=3,
|
99
99
|
parameters=[ctypes.c_int],
|
100
100
|
),
|
101
|
-
SupportedOp(name="reshape", inputs=2),
|
101
|
+
SupportedOp(name="reshape", inputs=2, parameters=[ctypes.c_bool, ctypes.c_int]),
|
102
102
|
SupportedOp(name="transpose", inputs=2),
|
103
103
|
SupportedOp(name="squeeze", inputs=1),
|
104
104
|
SupportedOp(name="unsqueeze", inputs=2),
|
@@ -137,5 +137,6 @@ def get_supported_ops() -> List[SupportedOp]:
|
|
137
137
|
SupportedOp(name="power", inputs=2),
|
138
138
|
SupportedOp(name="broadcast", inputs=2),
|
139
139
|
SupportedOp(name="log_softmax", inputs=1, parameters=[ctypes.c_int64]),
|
140
|
+
SupportedOp(name="rotate_half", inputs=1),
|
140
141
|
]
|
141
142
|
return supported_ops
|
@@ -157,6 +157,7 @@ class Tensor:
|
|
157
157
|
|
158
158
|
factory: "NNFactory" # type: ignore # noqa: F821
|
159
159
|
node: ctypes._Pointer
|
160
|
+
output_idx: int
|
160
161
|
|
161
162
|
@property
|
162
163
|
def shape(self) -> Sequence[int]:
|
@@ -166,8 +167,8 @@ class Tensor:
|
|
166
167
|
Returns:
|
167
168
|
Sequence[int]: The shape of the tensor.
|
168
169
|
"""
|
169
|
-
shape_size = backend_lib.op_shape_size(self.node)
|
170
|
-
return [backend_lib.op_shape(self.node, i) for i in range(shape_size)]
|
170
|
+
shape_size = backend_lib.op_shape_size(self.node, self.output_idx)
|
171
|
+
return [backend_lib.op_shape(self.node, i, self.output_idx) for i in range(shape_size)]
|
171
172
|
|
172
173
|
@property
|
173
174
|
def dtype(self) -> NPUDtype:
|
@@ -177,7 +178,7 @@ class Tensor:
|
|
177
178
|
Returns:
|
178
179
|
type: The data type of the tensor.
|
179
180
|
"""
|
180
|
-
dtype_int = backend_lib.op_dtype(self.node)
|
181
|
+
dtype_int = backend_lib.op_dtype(self.node, self.output_idx)
|
181
182
|
|
182
183
|
if dtype_int == 2:
|
183
184
|
return np.bool
|
Binary file
|
File without changes
|
{bigdl_core_npu-2.6.0b20241117.dist-info → bigdl_core_npu-2.6.0b20241118.dist-info}/top_level.txt
RENAMED
File without changes
|