You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

binaryop-broadcasting.md 1.2 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. ### broadcasting rule
  2. ncnn BinaryOp accepts blobs with different shape
  3. C = BinaryOp(A, B)
  4. shape notation convention is [w], [w,h], [w,h,c], [w,h,d,c]
  5. |type|A|B|C|
  6. |---|---|---|---|
  7. |1|[1]|scalar|[1]|
  8. |2|[1]|[2]|[2]|
  9. |3|[1]|[2,3]|[2,3]|
  10. |4|[1]|[2,3,4]|[2,3,4]|
  11. |5|[2]|scalar|[2]|
  12. |6|[2]|[1]|[2]|
  13. |7|[2]|[2]|[2]|
  14. |8|[3]|[2,3]|[2,3]|
  15. |9|[4]|[2,3,4]|[2,3,4]|
  16. |10|[2,3]|scalar|[2,3]|
  17. |11|[2,3]|[1]|[2,3]|
  18. |12|[2,3]|[3]|[2,3]|
  19. |13|[2,3]|[2,3]|[2,3]|
  20. |14|[3,4]|[2,3,4]|[2,3,4]|
  21. |15|[2,3,4]|scalar|[2,3,4]|
  22. |16|[2,3,4]|[1]|[2,3,4]|
  23. |17|[2,3,4]|[4]|[2,3,4]|
  24. |18|[2,3,4]|[3,4]|[2,3,4]|
  25. |19|[2,3,4]|[2,3,4]|[2,3,4]|
  26. |20|[1]|[2,3,4,5]|[2,3,4,5]|
  27. |21|[5]|[2,3,4,5]|[2,3,4,5]|
  28. |22|[4,5]|[2,3,4,5]|[2,3,4,5]|
  29. |23|[3,4,5]|[2,3,4,5]|[2,3,4,5]|
  30. |24|[2,3,4,5]|scalar|[2,3,4,5]|
  31. |25|[2,3,4,5]|[1]|[2,3,4,5]|
  32. |26|[2,3,4,5]|[5]|[2,3,4,5]|
  33. |27|[2,3,4,5]|[4,5]|[2,3,4,5]|
  34. |28|[2,3,4,5]|[3,4,5]|[2,3,4,5]|
  35. |29|[2,3,4,5]|[2,3,4,5]|[2,3,4,5]|
  36. some special broadcasting rule exists for model compatibility
  37. |special type|A|B|C|
  38. |---|---|---|---|
  39. |1|[2,3,4]|[1,1,4]|[2,3,4]|
  40. |2|[2,3,4]|[2,3,1]|[2,3,4]|
  41. |3|[1,1,4]|[2,3,4]|[2,3,4]|
  42. |4|[2,3,1]|[2,3,4]|[2,3,4]|
  43. |5|[2,3,4]|[1,3,4]|[2,3,4]|
  44. |6|[2,3,4]|[2,1,4]|[2,3,4]|
  45. |7|[1,3,4]|[2,3,4]|[2,3,4]|
  46. |8|[2,1,4]|[2,3,4]|[2,3,4]|