DzAvril opened a new pull request #10801:
URL: https://github.com/apache/tvm/pull/10801


   The input of op `concatenate` is a list of tensors. We tried to bring it to 
ACL and found the JSON node of it is like below.
   ```JSON
   {
     "nodes": [
       {
         "op": "input",
         "name": "arm_compute_lib_0_i0",
         "attrs": {
           "dtype": [
             [
               "int32",
               "int32",
               "int32"
             ]
           ],
           "shape": [
             [
               [1, 234, 234, 256],
               [1, 234, 234, 256],
               [1, 234, 234, 256]
             ]
           ]
         }
       },
       {
         "op": "kernel",
         "name": "concatenate",
         "inputs": [[
             0,
             0,
             0], [
             0,
             1,
             0], [
             0,
             2,
             0]],
         "attrs": {
           "num_outputs": "1",
           "num_inputs": "3",
           "dtype": [
             [
               "int32"
             ]
           ],
           "axis": [
             [
               "0"
             ]
           ],
           "shape": [
             [
               [3, 234, 234, 256]
             ]
           ]
         }
       }
     ],
     "arg_nodes": [0],
     "heads": [[
         1,
         0,
         0]],
     "node_row_ptr": [0, 3, 4]
   }
   ```
   The inputs of node `kernel` is:
   ```JSON
   "inputs": [[
             0,
             0,
             0], [
             0,
             1,
             0], [
             0,
             2,
             0]]
   ```
   Element in `inputs` is the index of `input` node. Taking `[0, 1, 0]` as an 
example, the first `0` is `nodeid`, the second `1` is `indexid`, and the last 
`0` is `version`.
   But in function `Run`, it only uses `0` as `indexid` in statement `uint32_t 
eid = EntryID(nid, 0);` so the other two inputs are ignored.
   ```c++
     void Run() override {
       for (size_t i = 0; i < input_nodes_.size(); ++i) {
         auto nid = input_nodes_[i];
         uint32_t eid = EntryID(nid, 0);
         if (nodes_[nid].GetOpType() == "input") {
           void* data = data_entry_[eid]->data;
           CheckACLError(layer_.inputs[i].allocator()->import_memory(data));
         }
       }
   
       for (size_t i = 0; i < outputs_.size(); ++i) {
         uint32_t eid = EntryID(outputs_[i]);
         void* data = data_entry_[eid]->data;
         CheckACLError(layer_.outputs[i].allocator()->import_memory(data));
       }
   
       this->layer_.function->run();
     }
   ```
   
   This PR introduces a variable `json_inputid_to_layer_inputid` which maps the 
input index of JSON node to the index of the ACL layer's inputs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to