How to contribute to Webgl ops?
Manojbhat09 opened this issue · comments
Please provide a short guide on how to write ops.
This commit is a good example of adding implementation for a operator on one or more backends.
A rough instruction -
-
add a new file (if it doesn't exist) under
lib/ops/
for the operator, implement an abstract class derived fromOperator
with member functioninitialize
,checkInputs
andcheckInputTypes
. Operator attributes are usually put here too. -
add a new file under
lib/backends/webgl/ops/
for the operator, implement a class that extends the abstract class described in (1) and implement interfaceWebGLOperator
as well.- function
run
usually implement as callingWebGLOperatorHelper.run()
, unless a custom step is required - function
createProgramInfo
returns the shader and layout - function
createRunData
returns the texture data and uniform binding (if any)
- function
-
add resolve rules in
/lib/backends/webgl/op-resolve-rules.ts
for the newly implemented operator. -
add standard node test or custom operator test in
unittest-whitelist.jsonc
.
Let me know if you have further questions