-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AddVer]fix bug of iqSub and update version V2.0.0
- Loading branch information
leofang3
committed
Aug 17, 2023
1 parent
720acec
commit 99156da
Showing
9 changed files
with
94 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
v2.0.0 2023.8.17 修复iqAdd和iqSub的离线内存分配问题,打包工具需和引擎代码保持一致,升级大版本; | ||
v1.1.0 2023.8.15 打包工具增加常量折叠、指定数据存放位置功能,优化内存分析报告的生成。引擎执行器增加一些常用接口,增加通用性;完善算子和支持更多的新算子; | ||
V1.0.0 2022.10.24 初始版本 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,33 @@ | ||
import math | ||
import numpy as np | ||
from typing import List | ||
|
||
from ...graph import Tensor | ||
from ...enum_defines import DevType | ||
from .base import iqBinaryOperator, register_op | ||
|
||
|
||
@register_op | ||
class iqSub(iqBinaryOperator): | ||
pass | ||
def get_workspace(self, dev_type: DevType) -> List[Tensor]: | ||
x1 = self.inputs[0] | ||
x2 = self.inputs[1] | ||
size = x1.nbytes | ||
Y = self.outputs[0] | ||
|
||
scale_x = self.attrs["scale_x"] | ||
scale_y = self.attrs["scale_y"] | ||
scale_o = self.attrs["scale_o"] | ||
|
||
workspace_size = 0 | ||
if (scale_x != scale_o) or x1.mem_type != MemType.SHARE_MEM: | ||
workspace_size += size | ||
if (scale_y != scale_o) or x2.mem_type != MemType.SHARE_MEM: | ||
workspace_size += size | ||
if Y.mem_type != MemType.SHARE_MEM: | ||
workspace_size = max(workspace_size, size) | ||
|
||
max_workspace = Tensor.from_shape([workspace_size], np.int8, MemType.SHARE_MEM) | ||
return [max_workspace] | ||
|
||
__all__ = ["iqSub"] |