| 128 | } |
| 129 | |
| 130 | static bool CheckBind(Node* node, struct custom_kernel_ops* ops) |
| 131 | { |
| 132 | /* prepare tensors */ |
| 133 | int input_num = node->GetInputNum(); |
| 134 | int output_num = node->GetOutputNum(); |
| 135 | |
| 136 | struct custom_kernel_tensor** k_inputs; |
| 137 | struct custom_kernel_tensor** k_outputs; |
| 138 | |
| 139 | if(!PrepareTensors(node, k_inputs, input_num, k_outputs, output_num)) |
| 140 | { |
| 141 | ReleaseTensors(node, k_inputs, input_num, k_outputs, output_num); |
| 142 | return false; |
| 143 | } |
| 144 | |
| 145 | int ret = ops->bind(ops, ( const struct custom_kernel_tensor** )k_inputs, input_num, |
| 146 | ( const struct custom_kernel_tensor** )k_outputs, output_num); |
| 147 | |
| 148 | ReleaseTensors(node, k_inputs, input_num, k_outputs, output_num); |
| 149 | |
| 150 | if(ret < 0) |
| 151 | return false; |
| 152 | |
| 153 | return true; |
| 154 | } |
| 155 | |
| 156 | NodeOps* BindOps(Node* node, const std::string& dev_name) |
| 157 | { |
no test coverage detected