Last active
September 26, 2018 18:48
-
-
Save jamesr66a/d8f2a1503a085e62b2973c138b9e8016 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Attributes: | |
op_kind: "Aten" | |
node_kind "aten::foo(Tensor a, int b, Tensor[] c) -> Tensor" | |
class AtenOp { | |
AtenOp() { | |
Graph g; | |
schema_ = SchemaParser(node_kind).parseDeclaration(); | |
for argument in schema.arguments: | |
g.addInput(argument.type) | |
Node * n = g.addNode(node_kind, g.inputs()); | |
operation = getOperatorForNode(n); | |
} | |
IValue convertToIValue(string, caffe2blob) { ... } | |
IValue convertToCaffe2(string, IValue) { ... } | |
void run() { | |
Stack s; | |
for arg in schema_.arguments { | |
s.push_back(convertToIValue(arg.type, input(i)); | |
} | |
operation(s); | |
for ret in schema_.returns { | |
Output(i) = convertToCaffe2(ret.type, stack[i]); | |
} | |
} | |
private: | |
Operation operation; | |
FunctionSchema schema_; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment