Skip to content

Commit e130a00

Browse files
committed
pytorch converter
1 parent 5310e8d commit e130a00

File tree

21 files changed

+2712
-2
lines changed

21 files changed

+2712
-2
lines changed

nnvm/include/nnvm/top/nn.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,45 @@ struct GlobalPool2DParam : public dmlc::Parameter<GlobalPool2DParam> {
394394
}
395395
};
396396

397+
398+
struct AdaptiveMaxPool2DParam : public dmlc::Parameter<AdaptiveMaxPool2DParam> {
399+
int out_height;
400+
int out_width;
401+
std::string layout;
402+
403+
DMLC_DECLARE_PARAMETER(AdaptiveMaxPool2DParam) {
404+
DMLC_DECLARE_FIELD(out_height)
405+
.describe("Output height");
406+
DMLC_DECLARE_FIELD(out_width)
407+
.describe("Output width");
408+
DMLC_DECLARE_FIELD(layout).set_default("NCHW")
409+
.describe("Dimension ordering of data and weight. Can be 'NCHW', 'NHWC', etc."
410+
"'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
411+
"dimensions respectively. Convolution is applied on the 'H' and"
412+
"'W' dimensions.");
413+
}
414+
};
415+
416+
417+
struct AdaptiveAvgPool2DParam : public dmlc::Parameter<AdaptiveAvgPool2DParam> {
418+
int out_height;
419+
int out_width;
420+
std::string layout;
421+
422+
DMLC_DECLARE_PARAMETER(AdaptiveAvgPool2DParam) {
423+
DMLC_DECLARE_FIELD(out_height)
424+
.describe("Output height");
425+
DMLC_DECLARE_FIELD(out_width)
426+
.describe("Output width");
427+
DMLC_DECLARE_FIELD(layout).set_default("NCHW")
428+
.describe("Dimension ordering of data and weight. Can be 'NCHW', 'NHWC', etc."
429+
"'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
430+
"dimensions respectively. Convolution is applied on the 'H' and"
431+
"'W' dimensions.");
432+
}
433+
};
434+
435+
397436
struct UpSamplingParam : public dmlc::Parameter<UpSamplingParam> {
398437
int scale;
399438
std::string layout;

nnvm/python/nnvm/frontend/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
from .darknet import from_darknet
88
from .tensorflow import from_tensorflow
99
from .caffe2 import from_caffe2
10+
from .pytorch import from_pytorch
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
r'''PyTorch->NNVM converter'''
2+
from .converter import from_pytorch

0 commit comments

Comments
 (0)