-
Notifications
You must be signed in to change notification settings - Fork 629
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[New Feature] Support Paddle PIR Visualization 🚀 (#1263)
* add new_ir visualization * refine some interface * fix pir to kwargs
- Loading branch information
Showing
7 changed files
with
291 additions
and
157 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import paddle | ||
from paddle import ir | ||
|
||
from visualdl import LogWriter | ||
|
||
paddle.enable_static() | ||
|
||
main_program, start_program = ( | ||
paddle.static.Program(), | ||
paddle.static.Program(), | ||
) | ||
with paddle.static.program_guard(main_program, start_program): | ||
x = paddle.static.data("x", [1, 64, 64, 8], dtype="float32") | ||
y = paddle.static.data("y", [1, 64, 64, 8], dtype="float32") | ||
divide_out = paddle.divide(x, y) | ||
tanh_out = paddle.tanh(divide_out) | ||
conv2d = paddle.nn.Conv2D(8, 32, 1, bias_attr=False, data_format='NHWC') | ||
batch_norm = paddle.nn.BatchNorm(32, act='relu', data_layout='NHWC') | ||
out = batch_norm(conv2d(tanh_out)) | ||
|
||
newir_program = ir.translate_to_new_ir(main_program.desc) | ||
|
||
with LogWriter(logdir="./log/program_test/") as writer: | ||
writer.add_graph( | ||
model=newir_program, | ||
input_spec=[paddle.static.InputSpec([-1, 1, 28, 28], 'float32')], | ||
verbose=True, | ||
is_pir=True) |
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
Oops, something went wrong.