Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ColossalAI
Commits
1be0ac3c
Commit
1be0ac3c
authored
Jan 09, 2023
by
oahzxl
Browse files
add doc for trace indice
parent
0b6af554
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
5 deletions
+26
-5
colossalai/autochunk/trace_indice.py
colossalai/autochunk/trace_indice.py
+26
-5
No files found.
colossalai/autochunk/trace_indice.py
View file @
1be0ac3c
import
copy
from
typing
import
Dict
,
List
,
Tuple
from
.utils
import
(
find_idx_by_name
,
get_node_shape
,
)
from
torch.fx.node
import
Node
from
.utils
import
find_idx_by_name
,
get_node_shape
class
TraceIndice
(
object
):
def
__init__
(
self
,
node_list
)
->
None
:
"""
Trace all indice infomation for every node.
Indice is a logical concept. Equal dims can been treated as one indice.
eg. dim(x1) = [a, b, c]
dim(x2) = [d, e, f]
and we have x3 = x1 * x2.
then a=d, b=e, c=f, due to the broadcast property,
dim(x1)=dim(x2)=dim(x3)=[a, b, c]
This class will record every node's dims' indice, compute and source.
Attibutes:
node_list (List)
indice_trace_list (List): [{"indice": [...], "compute": [...], "source": [...]}, {...}]
indice_view_list (Dict): not used for now
indice_count (int): record indice number
Args:
node_list (List)
"""
def
__init__
(
self
,
node_list
:
List
)
->
None
:
self
.
node_list
=
node_list
self
.
indice_trace_list
=
self
.
_init_indice_trace_list
()
self
.
indice_view_list
=
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment