Patent ID: 11907112
Assignee: HORIZON (SHANGHAI) ARTIFICIAL INTELLIGENCE TECHNOLOGY CO., LTD
Field: Computer technology (Electrical engineering)
Classification: CPC G | IPC G

Claim 0:
1. A method for calculating tensor data using a data processing chip of a computer, including:
determining a first dimension of a second tensor different from a corresponding dimension of a first tensor based on dimensions of the first tensor and dimensions of the second tensor;
updating, by means of compiling, a stride value associated with the first dimension of the second tensor, wherein the stride value is a predetermined value;
reading a target data block of the second tensor from a buffer module based on an updated stride value that is equal to the predetermined value in each dimension of the second tensor, wherein the target data block is a padded data block, by means of compiling, whose size is equal to its size before padded plus a size of padding data, wherein a reading position of the buffer module which is determined by the updated stride value, is positioned, by means of compiling, to a position of the target data block; and
performing binary operation on data blocks of the first tensor based on the target data block of the second tensor; wherein before updating stride in the different dimension to a predetermined value, the method further includes: performing padding processing on the second tensor through copying valid data of the second tensor to form the to-be-operated data block of the second tensor; wherein the performing padding processing on the second tensor through copying valid data of the second tensor to form the to-be-operated data block of the second tensor includes: buffering the valid data of the second tensor into the buffer module based on non-updated stride in each dimension of the second tensor; determining a buffer area, in the buffer module, of the valid data for padding processing based on the updated stride with the predetermined value in each dimension of the second tensor; and copying the valid data in the buffer area and padding out the buffer area with the copied valid data, to form the to-be-operated data block of the second tensor; wherein the buffering the valid data of the second tensor into the buffer module based on non-updated stride in each dimension of the second tensor includes: calculating a second offset address for the valid data of the second tensor based on the non-updated stride in each dimension of the second tensor; and buffering the valid data into the buffer area according to the start address of the second tensor and the second offset address.