meaning of function flush() #205
Unanswered
AlbertoPresta
asked this question in
Q&A
Replies: 1 comment
-
Flushing a buffer means emptying its contents, and using these contents to do some work. For instance, try running: import subprocess
with open("file.txt", "w") as f:
print("This line was flushed.", file=f)
f.flush()
print("$ cat file.txt")
subprocess.run(["cat", "file.txt"])
print("This line will not show until flushed.", file=f)
print("This line is also buffered.", file=f)
print("$ cat file.txt")
subprocess.run(["cat", "file.txt"])
# f.flush() # Automatically called when file is closed, or if buffer grows too large. Output: $ cat file.txt
This line was flushed.
$ cat file.txt
This line was flushed. In CompressAI, the underlying encoder is buffering the intermediate symbols that it will encode. When |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
What is the meaning of function encoder.flush() in line 644 of google.py module?
Thanks in advance for answer,
Alberto
Beta Was this translation helpful? Give feedback.
All reactions