The present application discloses a
tensor calculation method, an electronic device, a storage medium, and a product, relating to the technical field of
data processing, including obtaining a target
tensor calculation task; determining a plurality of streams based on the number of tensors in the target
tensor calculation task; determining subtasks assigned to each
stream based on the target tensor calculation task and the plurality of streams; using an
event synchronization mechanism to manage the dependency relationships between the plurality of streams, and starting the kernels corresponding to each
stream in parallel to complete the calculation of the subtasks, which solves the technical problem in the related solutions that when multiple tensors with smaller scales perform bit-by-bit operations, they cannot fully occupy the accelerator calculation units, resulting in
low resource utilization, and each group of tensors has a corresponding kernel to be started, resulting in the accumulation of calculation time consumption, and further resulting in low tensor calculation efficiency, and achieves the technical effect of improving
resource utilization, reducing the time consumption of starting kernels for tensors, and further improving the tensor calculation efficiency.