-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CodeStyle][py2] remove six
package (part2)
#47334
Changes from all commits
34d006d
adf3c66
cd2bfe5
c03db06
7cab537
61093b1
bfe38e0
330caa1
1fc3036
517a695
d682b86
e40cfd7
829230d
2cb5843
ea40f42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5777,10 +5777,10 @@ def clone(self, for_test=False): | |
|
||
.. code-block:: python | ||
|
||
import six | ||
import paddle | ||
|
||
def print_prog(prog): | ||
for name, value in sorted(six.iteritems(prog.block(0).vars)): | ||
for name, value in sorted(prog.block(0).vars.items()): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. API docs changes 1: 这里前面不加一个 不过这个问题本地直接用 |
||
print(value) | ||
for op in prog.block(0).ops: | ||
print("op type is {}".format(op.type)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15001,7 +15001,6 @@ def py_func(func, x, out, backward_func=None, skip_vars_in_backward_input=None): | |
|
||
# example 1: | ||
import paddle | ||
import six | ||
import numpy as np | ||
|
||
paddle.enable_static() | ||
|
@@ -15027,7 +15026,7 @@ def create_tmp_var(name, dtype, shape): | |
|
||
def simple_net(img, label): | ||
hidden = img | ||
for idx in six.moves.range(4): | ||
for idx in range(4): | ||
hidden = paddle.static.nn.fc(hidden, size=200) | ||
new_hidden = create_tmp_var(name='hidden_{}'.format(idx), | ||
dtype=hidden.dtype, shape=hidden.shape) | ||
|
@@ -15045,13 +15044,13 @@ def simple_net(img, label): | |
return ce_loss(prediction, label) | ||
|
||
x = paddle.static.data(name='x', shape=[1,4], dtype='float32') | ||
y = paddle.static.data(name='y', shape=[1,10], dtype='int64') | ||
y = paddle.static.data(name='y', shape=[1], dtype='int64') | ||
res = simple_net(x, y) | ||
|
||
exe = paddle.static.Executor(paddle.CPUPlace()) | ||
exe.run(paddle.static.default_startup_program()) | ||
input1 = np.random.random(size=[1,4]).astype('float32') | ||
input2 = np.random.randint(1, 10, size=[1,10], dtype='int64') | ||
input2 = np.random.randint(1, 10, size=[1], dtype='int64') | ||
out = exe.run(paddle.static.default_main_program(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. API docs changes 2:
|
||
feed={'x':input1, 'y':input2}, | ||
fetch_list=[res.name]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里于 #18482 和 #18957 在 reraise 之前有一个针对
core.EOFException
的处理,该处理已于 #25692 移除,但没有清理外面的 try-except 结构,因此这里直接清除掉