Skip to content

Commit

Permalink
pytorch converter
Browse files Browse the repository at this point in the history
  • Loading branch information
markrogersjr committed May 14, 2019
1 parent 8f0ab0a commit 51ee22a
Show file tree
Hide file tree
Showing 23 changed files with 2,587 additions and 343 deletions.
16 changes: 0 additions & 16 deletions include/tvm/relay/attrs/nn.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,22 +332,6 @@ struct GlobalPool2DAttrs : public tvm::AttrsNode<GlobalPool2DAttrs> {
}
};

/*! \brief Attributes for adaptive pool operator */
struct AdaptivePool2DAttrs : public tvm::AttrsNode<AdaptivePool2DAttrs> {
Array<IndexExpr> output_size;
std::string layout;

TVM_DECLARE_ATTRS(AdaptivePool2DAttrs, "relay.attrs.AdaptivePool2DAttrs") {
TVM_ATTR_FIELD(output_size).set_default(Array<IndexExpr>({}))
.describe("Output height and width.");
TVM_ATTR_FIELD(layout).set_default("NCHW")
.describe("Dimension ordering of data and weight. Can be 'NCHW', 'NHWC', etc."
"'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
"dimensions respectively. Convolution is applied on the 'H' and"
"'W' dimensions.");
}
};


/*! \brief Attributes for dense operator */
struct DenseAttrs : public tvm::AttrsNode<DenseAttrs> {
Expand Down
33 changes: 33 additions & 0 deletions nnvm/include/nnvm/top/nn.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,39 @@ struct GlobalPool2DParam : public dmlc::Parameter<GlobalPool2DParam> {
}
};


struct AdaptiveMaxPool2DParam : public dmlc::Parameter<AdaptiveMaxPool2DParam> {
TShape output_size;
std::string layout;

DMLC_DECLARE_PARAMETER(AdaptiveMaxPool2DParam) {
DMLC_DECLARE_FIELD(output_size)
.describe("Output height and width");
DMLC_DECLARE_FIELD(layout).set_default("NCHW")
.describe("Dimension ordering of data and weight. Can be 'NCHW', 'NHWC', etc."
"'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
"dimensions respectively. Convolution is applied on the 'H' and"
"'W' dimensions.");
}
};


struct AdaptiveAvgPool2DParam : public dmlc::Parameter<AdaptiveAvgPool2DParam> {
TShape output_size;
std::string layout;

DMLC_DECLARE_PARAMETER(AdaptiveAvgPool2DParam) {
DMLC_DECLARE_FIELD(output_size)
.describe("Output height and width");
DMLC_DECLARE_FIELD(layout).set_default("NCHW")
.describe("Dimension ordering of data and weight. Can be 'NCHW', 'NHWC', etc."
"'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
"dimensions respectively. Convolution is applied on the 'H' and"
"'W' dimensions.");
}
};


struct UpSamplingParam : public dmlc::Parameter<UpSamplingParam> {
int scale;
std::string layout;
Expand Down
1 change: 1 addition & 0 deletions nnvm/python/nnvm/frontend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
from .darknet import from_darknet
from .tensorflow import from_tensorflow
from .caffe2 import from_caffe2
from .pytorch import from_pytorch
2 changes: 2 additions & 0 deletions nnvm/python/nnvm/frontend/pytorch/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
r'''PyTorch->NNVM converter'''
from .converter import from_pytorch
Loading

0 comments on commit 51ee22a

Please sign in to comment.