未验证 提交 81d54c3e 编写于 作者: L littletomatodonkey 提交者: GitHub

fix prod (#3377)

上级 a30e9869
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
# limitations under the License. # limitations under the License.
import math import math
import numpy as np
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
...@@ -136,7 +137,7 @@ def _calculate_fan_in_and_fan_out(tensor, reverse=False): ...@@ -136,7 +137,7 @@ def _calculate_fan_in_and_fan_out(tensor, reverse=False):
receptive_field_size = 1 receptive_field_size = 1
if tensor.ndim > 2: if tensor.ndim > 2:
receptive_field_size = math.prod(tensor.shape[2:]) receptive_field_size = np.prod(tensor.shape[2:])
fan_in = num_input_fmaps * receptive_field_size fan_in = num_input_fmaps * receptive_field_size
fan_out = num_output_fmaps * receptive_field_size fan_out = num_output_fmaps * receptive_field_size
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册