tensorflow / tensorflow/models
Performance issue in research/seq_flow_lite/models/sgnn/sgnn.py
Open
Nobody has claimed this yet.
models:research
type:bug
- Dominant language
- Python
- Stars
- 77.7k
- Forks
- 44.8k
- PR merge metrics
- No merged PRs in 30d
Description
Hello! Our static bug checker has found a performance issue in research/seq_flow_lite/models/sgnn/sgnn.py: fused_project is repeatedly called in a for loop, but there is a tf.function decorated function func defined and called in fused_project.
In that case, when fused_project is called in a loop, the function func will create a new graph every time, and that can trigger tf.function retracing warning.
Here is the tensorflow document to support it.
Briefly, for better efficiency, it's better to use:
@tf.function
def inner():
pass
def outer():
inner()
than:
def outer():
@tf.function
def inner():
pass
inner()
Looking forward to your reply.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.