Generate docstring for the class obtaining it from schema based on cls.__name__ or the schema name as a str. This lists all the Keyword args that can be used when creating operator
(schema_name, api)
| 224 | |
| 225 | |
| 226 | def _docstring_generator_main(schema_name, api): |
| 227 | """ |
| 228 | Generate docstring for the class obtaining it from schema based on cls.__name__ |
| 229 | or the schema name as a str. |
| 230 | This lists all the Keyword args that can be used when creating operator |
| 231 | """ |
| 232 | schema = _b.GetSchema(schema_name) |
| 233 | ret = "\n" |
| 234 | |
| 235 | if schema.IsDeprecated(): |
| 236 | ret += ".. warning::\n\n This operator is now deprecated." |
| 237 | replacement = schema.DeprecatedInFavorOf() |
| 238 | if replacement: |
| 239 | use_instead = _names._op_name(replacement, api) |
| 240 | ret += " Use :meth:`" + use_instead + "` instead." |
| 241 | explanation = schema.DeprecationMessage() |
| 242 | if explanation: |
| 243 | indent = "\n" + " " * 3 |
| 244 | ret += indent |
| 245 | ret += indent |
| 246 | explanation = explanation.replace("\n", indent) |
| 247 | ret += explanation |
| 248 | ret += "\n\n" |
| 249 | |
| 250 | ret += schema.Dox() |
| 251 | ret += "\n" |
| 252 | |
| 253 | if schema.IsDocPartiallyHidden(): |
| 254 | return ret |
| 255 | |
| 256 | supported_statements = [] |
| 257 | if schema.IsSequenceOperator(): |
| 258 | supported_statements.append("expects sequence inputs") |
| 259 | elif schema.AllowsSequences(): |
| 260 | supported_statements.append("allows sequence inputs") |
| 261 | |
| 262 | if schema.SupportsVolumetric(): |
| 263 | supported_statements.append("supports volumetric data") |
| 264 | |
| 265 | if len(supported_statements) > 0: |
| 266 | ret += "\nThis operator " |
| 267 | ret += supported_statements[0] |
| 268 | if len(supported_statements) > 1: |
| 269 | ret += " and " + supported_statements[1] |
| 270 | ret += ".\n" |
| 271 | |
| 272 | if schema.IsNoPrune() and api != "dynamic": |
| 273 | ret += "\nThis operator will **not** be optimized out of the graph.\n" |
| 274 | |
| 275 | op_dev = [] |
| 276 | if schema_name in _registry.cpu_ops(): |
| 277 | op_dev.append("'cpu'") |
| 278 | if schema_name in _registry.gpu_ops(): |
| 279 | op_dev.append("'gpu'") |
| 280 | if schema_name in _registry.mixed_ops(): |
| 281 | op_dev.append("'mixed'") |
| 282 | ret += """ |
| 283 | Supported backends |
no test coverage detected