Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
added comments and warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Roshrini authored and rajanksin committed Jun 16, 2018
1 parent f4902e1 commit f36230d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import re
import logging
import numpy as np
from .export_onnx import MXNetGraph as mx_op


def import_onnx_modules():
""" To make sure ONNX is runtime dependency, it is imported used only when needed"""
try:
Expand Down Expand Up @@ -94,6 +95,7 @@ def transform_padding(pad_width):
onnx_pad_width = [0]*num_pad_values

start_index = 0
# num_pad_values will always be multiple of 2
end_index = int(num_pad_values/2)
for idx in range(0, num_pad_values):
if idx % 2 == 0:
Expand Down Expand Up @@ -552,6 +554,15 @@ def convert_pooling(node, **kwargs):
input_node = proc_nodes[input_node_idx]
name = node["name"]

pooling_convention = attrs.get('pooling_convention', 'valid')

if pooling_convention == 'full':
pooling_warning = "Pooling: ONNX currently doesn't support pooling_convention. " \
"This might lead to shape or accuracy issues. " \
"https://github.com/onnx/onnx/issues/549"

logging.warning(pooling_warning)

pad_dims = list(parse_helper(attrs, "pad", [0, 0]))
pad_dims = pad_dims + pad_dims
pool_types = {"max": "MaxPool", "avg": "AveragePool"}
Expand Down

0 comments on commit f36230d

Please sign in to comment.