Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom operator support #15

Open
kennu opened this issue May 9, 2017 · 0 comments
Open

Custom operator support #15

kennu opened this issue May 9, 2017 · 0 comments

Comments

@kennu
Copy link

kennu commented May 9, 2017

I'm trying to load a model trained using the MXNet DQN example. I managed to export the symbols as a JSON structure shown below. But when I try to load it into MXNet.js, I get this error:

mxnet_predict-all.cc:637: [17:17:32] mxnet_predict-all.cc:22177: Check failed: op != nullptr Operator Custom is not registered

I couldn't find any mention of custom operators in the docs. Should I add something somewhere to make them work?

{
  "nodes": [
    {
      "op": "null", 
      "name": "data", 
      "inputs": []
    }, 
    {
      "op": "null", 
      "name": "conv1_weight", 
      "attr": {
        "kernel": "(8, 8)", 
        "num_filter": "32", 
        "stride": "(4, 4)"
      }, 
      "inputs": []
    }, 
    {
      "op": "null", 
      "name": "conv1_bias", 
      "attr": {
        "kernel": "(8, 8)", 
        "num_filter": "32", 
        "stride": "(4, 4)"
      }, 
      "inputs": []
    }, 
    {
      "op": "Convolution", 
      "name": "conv1", 
      "attr": {
        "kernel": "(8, 8)", 
        "num_filter": "32", 
        "stride": "(4, 4)"
      }, 
      "inputs": [[0, 0, 0], [1, 0, 0], [2, 0, 0]]
    }, 
    {
      "op": "Activation", 
      "name": "relu1", 
      "attr": {"act_type": "relu"}, 
      "inputs": [[3, 0, 0]]
    }, 
    {
      "op": "null", 
      "name": "conv2_weight", 
      "attr": {
        "kernel": "(4, 4)", 
        "num_filter": "64", 
        "stride": "(2, 2)"
      }, 
      "inputs": []
    }, 
    {
      "op": "null", 
      "name": "conv2_bias", 
      "attr": {
        "kernel": "(4, 4)", 
        "num_filter": "64", 
        "stride": "(2, 2)"
      }, 
      "inputs": []
    }, 
    {
      "op": "Convolution", 
      "name": "conv2", 
      "attr": {
        "kernel": "(4, 4)", 
        "num_filter": "64", 
        "stride": "(2, 2)"
      }, 
      "inputs": [[4, 0, 0], [5, 0, 0], [6, 0, 0]]
    }, 
    {
      "op": "Activation", 
      "name": "relu2", 
      "attr": {"act_type": "relu"}, 
      "inputs": [[7, 0, 0]]
    }, 
    {
      "op": "null", 
      "name": "conv3_weight", 
      "attr": {
        "kernel": "(3, 3)", 
        "num_filter": "64", 
        "stride": "(1, 1)"
      }, 
      "inputs": []
    }, 
    {
      "op": "null", 
      "name": "conv3_bias", 
      "attr": {
        "kernel": "(3, 3)", 
        "num_filter": "64", 
        "stride": "(1, 1)"
      }, 
      "inputs": []
    }, 
    {
      "op": "Convolution", 
      "name": "conv3", 
      "attr": {
        "kernel": "(3, 3)", 
        "num_filter": "64", 
        "stride": "(1, 1)"
      }, 
      "inputs": [[8, 0, 0], [9, 0, 0], [10, 0, 0]]
    }, 
    {
      "op": "Activation", 
      "name": "relu3", 
      "attr": {"act_type": "relu"}, 
      "inputs": [[11, 0, 0]]
    }, 
    {
      "op": "Flatten", 
      "name": "flatten0", 
      "inputs": [[12, 0, 0]]
    }, 
    {
      "op": "null", 
      "name": "fc4_weight", 
      "attr": {"num_hidden": "512"}, 
      "inputs": []
    }, 
    {
      "op": "null", 
      "name": "fc4_bias", 
      "attr": {"num_hidden": "512"}, 
      "inputs": []
    }, 
    {
      "op": "FullyConnected", 
      "name": "fc4", 
      "attr": {"num_hidden": "512"}, 
      "inputs": [[13, 0, 0], [14, 0, 0], [15, 0, 0]]
    }, 
    {
      "op": "Activation", 
      "name": "relu4", 
      "attr": {"act_type": "relu"}, 
      "inputs": [[16, 0, 0]]
    }, 
    {
      "op": "null", 
      "name": "fc5_weight", 
      "attr": {"num_hidden": "3"}, 
      "inputs": []
    }, 
    {
      "op": "null", 
      "name": "fc5_bias", 
      "attr": {"num_hidden": "3"}, 
      "inputs": []
    }, 
    {
      "op": "FullyConnected", 
      "name": "fc5", 
      "attr": {"num_hidden": "3"}, 
      "inputs": [[17, 0, 0], [18, 0, 0], [19, 0, 0]]
    }, 
    {
      "op": "null", 
      "name": "dqn_action", 
      "attr": {"op_type": "DQNOutput"}, 
      "inputs": []
    }, 
    {
      "op": "null", 
      "name": "dqn_reward", 
      "attr": {"op_type": "DQNOutput"}, 
      "inputs": []
    }, 
    {
      "op": "Custom", 
      "name": "dqn", 
      "attr": {"op_type": "DQNOutput"}, 
      "inputs": [[20, 0, 0], [21, 0, 0], [22, 0, 0]]
    }
  ], 
  "arg_nodes": [
    0, 
    1, 
    2, 
    5, 
    6, 
    9, 
    10, 
    14, 
    15, 
    18, 
    19, 
    21, 
    22
  ], 
  "node_row_ptr": [
    0, 
    1, 
    2, 
    3, 
    4, 
    5, 
    6, 
    7, 
    8, 
    9, 
    10, 
    11, 
    12, 
    13, 
    14, 
    15, 
    16, 
    17, 
    18, 
    19, 
    20, 
    21, 
    22, 
    23, 
    24
  ], 
  "heads": [[23, 0, 0]], 
  "attrs": {"mxnet_version": ["int", 905]}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant