qairt-visualizer 0.5.1__py3-none-win_amd64.whl → 0.7.0__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qairt_visualizer/core/helpers/version.py +23 -0
- qairt_visualizer/core/launchers/base_ui_launcher_context.py +28 -7
- qairt_visualizer/core/launchers/electron_launcher_context.py +72 -3
- qairt_visualizer/core/parsers/dlc_parser/dlc_parser.py +105 -33
- qairt_visualizer/core/parsers/dlc_parser/get_source_topology.py +47 -0
- qairt_visualizer/core/parsers/dlc_parser/libDlModelToolsPy.pyd +0 -0
- qairt_visualizer/core/parsers/dlc_parser/libDlModelToolsPy.so +0 -0
- qairt_visualizer/core/parsers/dlc_parser/libPyIrGraph.pyd +0 -0
- qairt_visualizer/core/parsers/dlc_parser/libPyIrGraph.so +0 -0
- qairt_visualizer/core/parsers/dlc_parser/models/op_tensor_mappings.py +8 -4
- qairt_visualizer/core/ui/dist/browser/__init__.py +47 -0
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/acuity.js → acuity.js} +3 -3
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/app.js → app.js} +63 -57
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/armnn-schema.js → armnn-schema.js} +590 -5
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/armnn.js → armnn.js} +3 -5
- qairt_visualizer/core/ui/dist/browser/assets/i18n/common/en.json +8 -2
- qairt_visualizer/core/ui/dist/browser/assets/i18n/graph/en.json +44 -36
- qairt_visualizer/core/ui/dist/browser/assets/i18n/panels/en.json +9 -3
- qairt_visualizer/core/ui/dist/browser/assets/i18n/panels/model-diff/en.json +6 -0
- qairt_visualizer/core/ui/dist/browser/assets/i18n/workspaces/en.json +3 -0
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/barracuda.js → barracuda.js} +3 -3
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/base.js → base.js} +20 -16
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/bigdl.js → bigdl.js} +2 -2
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/browser.js → browser.js} +59 -49
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/caffe.js → caffe.js} +3 -3
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/caffe2-proto.js → caffe2-proto.js} +26 -26
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/caffe2.js → caffe2.js} +113 -114
- qairt_visualizer/core/ui/dist/browser/chunk-3SMGFPTN.js +11 -0
- qairt_visualizer/core/ui/dist/browser/chunk-43LQFSHA.js +1 -0
- qairt_visualizer/core/ui/dist/browser/chunk-447NKSFT.js +1 -0
- qairt_visualizer/core/ui/dist/browser/chunk-5MAR72QP.js +1 -0
- qairt_visualizer/core/ui/dist/browser/chunk-7PTY53DS.js +5 -0
- qairt_visualizer/core/ui/dist/browser/chunk-GAUD627J.js +1 -0
- qairt_visualizer/core/ui/dist/browser/chunk-H7TLLCSI.js +1 -0
- qairt_visualizer/core/ui/dist/browser/chunk-HISUA6LZ.js +4 -0
- qairt_visualizer/core/ui/dist/browser/chunk-HXB7IAZI.js +1 -0
- qairt_visualizer/core/ui/dist/browser/chunk-JPD5T7FP.js +120 -0
- qairt_visualizer/core/ui/dist/browser/chunk-L3QJ7DR2.js +1 -0
- qairt_visualizer/core/ui/dist/browser/{chunk-HBP6TEQ6.js → chunk-MCR4N53U.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/chunk-QD7PA2I4.js +19 -0
- qairt_visualizer/core/ui/dist/browser/chunk-TKZG6FLW.js +12 -0
- qairt_visualizer/core/ui/dist/browser/chunk-WFAVWONI.js +5 -0
- qairt_visualizer/core/ui/dist/browser/chunk-WRMDGTCT.js +35 -0
- qairt_visualizer/core/ui/dist/browser/chunk-X25J6H7V.js +1 -0
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/circle-schema.js → circle-schema.js} +17 -0
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/circle.js → circle.js} +3 -3
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/cntk.js → cntk.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/coreml-proto.js → coreml-proto.js} +1 -0
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/coreml.js → coreml.js} +24 -21
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/dagre.js → dagre.js} +5 -5
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/darknet-metadata.json → darknet-metadata.json} +0 -1
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/darknet.js → darknet.js} +3 -3
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/electron.mjs → desktop.mjs} +44 -131
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/dl4j.js → dl4j.js} +5 -2
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/dlc-schema.js → dlc-schema.js} +8 -8
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/dlc.js → dlc.js} +110 -29
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/dnn.js → dnn.js} +2 -4
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/dot.js → dot.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/eaix.js +24 -0
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/espresso.js → espresso.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/executorch-schema.js → executorch-schema.js} +363 -42
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/executorch.js → executorch.js} +108 -40
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/flatbuffers.js → flatbuffers.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/flax.js → flax.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/flux.js → flux.js} +2 -2
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/gguf.js → gguf.js} +44 -24
- qairt_visualizer/core/ui/dist/browser/grapher.css +145 -0
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/grapher.js → grapher.js} +24 -48
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/hailo.js → hailo.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/hickle.js → hickle.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/imgdnn.js → imgdnn.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/index.html +15 -16
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/index.js → index.js} +2 -24
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/json.js → json.js} +28 -3
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/kann.js → kann.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/keras-metadata.json → keras-metadata.json} +15 -7
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/keras.js → keras.js} +13 -7
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/kmodel.js → kmodel.js} +3 -3
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/lasagne.js → lasagne.js} +2 -2
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/lightgbm.js → lightgbm.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/main-EVI665MB.js +1 -0
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/mediapipe.js → mediapipe.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/megengine.js → megengine.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/message.js → message.js} +3 -2
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/mlir.js → mlir.js} +53 -17
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/mlnet.js → mlnet.js} +2 -3
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/mnn-schema.js → mnn-schema.js} +9 -6
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/mnn.js → mnn.js} +2 -2
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/mslite.js → mslite.js} +3 -3
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/mxnet.js → mxnet.js} +2 -2
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/ncnn.js → ncnn.js} +3 -2
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/nnabla.js → nnabla.js} +4 -4
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/nnef.js → nnef.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/node.js +102 -0
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/numpy.js → numpy.js} +9 -9
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/om.js → om.js} +2 -2
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/onednn.js → onednn.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/onnx-metadata.json → onnx-metadata.json} +3500 -233
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/onnx-proto.js → onnx-proto.js} +436 -4
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/onnx.js → onnx.js} +284 -199
- qairt_visualizer/core/ui/dist/browser/onnx.py +231 -0
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/openvino.js → openvino.js} +36 -31
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/paddle-proto.js → paddle-proto.js} +54 -54
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/paddle.js → paddle.js} +22 -3
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/pickle.js → pickle.js} +3 -3
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/python.js → python.js} +743 -325
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/pytorch-metadata.json → pytorch-metadata.json} +3217 -2934
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/pytorch-proto.js → pytorch-proto.js} +4 -4
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/pytorch.js → pytorch.js} +172 -86
- qairt_visualizer/core/ui/dist/browser/pytorch.py +304 -0
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/qnn.js → qnn.js} +6 -2
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/rknn.js → rknn.js} +3 -3
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/safetensors.js → safetensors.js} +2 -2
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/sentencepiece.js → sentencepiece.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/server.py → server.py} +95 -103
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/sklearn-metadata.json → sklearn-metadata.json} +15 -10
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/sklearn.js → sklearn.js} +5 -5
- qairt_visualizer/core/ui/dist/browser/{styles-MRR6DOT2.css → styles-2Z5PB4WZ.css} +1 -1
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/tar.js → tar.js} +18 -1
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/tengine.js → tengine.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/tensorrt.js → tensorrt.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/tf-metadata.json → tf-metadata.json} +1255 -163
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/tf-proto.js → tf-proto.js} +46 -12
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/tf.js → tf.js} +36 -13
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/tflite.js → tflite.js} +18 -21
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/tnn.js → tnn.js} +1 -3
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/torch.js → torch.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/transformers.js +171 -0
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/tvm.js → tvm.js} +2 -2
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/uff.js → uff.js} +2 -2
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/view.js → view.js} +1406 -1115
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/weka.js → weka.js} +3 -4
- qairt_visualizer/core/ui/dist/browser/worker-EHYFMTM7.js +1 -0
- qairt_visualizer/core/ui/dist/browser/worker-KX5DA6GL.js +4 -0
- qairt_visualizer/core/ui/dist/browser/xgboost.js +59 -0
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/xml.js → xml.js} +2 -2
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/xmodel.js → xmodel.js} +1 -1
- qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/zip.js → zip.js} +38 -41
- qairt_visualizer/core/ui/dist/qairt_visualizer.exe +0 -0
- qairt_visualizer/core/ui/dist/resources/app.asar +0 -0
- {qairt_visualizer-0.5.1.dist-info → qairt_visualizer-0.7.0.dist-info}/METADATA +1 -1
- qairt_visualizer-0.7.0.dist-info/RECORD +265 -0
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/CITATION.cff +0 -10
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/CONTRIBUTING.md +0 -29
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/LICENSE +0 -21
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/README.md +0 -36
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/jenkins/Jenkinsfile +0 -69
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/package-lock.json +0 -5743
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/package.js +0 -689
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/package.json +0 -53
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/package.py +0 -87
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/publish/background.png +0 -0
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/publish/background.svg +0 -5
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/publish/background@2x.png +0 -0
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/publish/electron-builder.json +0 -109
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/publish/eslint.config.js +0 -231
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/publish/forge.config.js +0 -87
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/publish/icon.html +0 -27
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/publish/icon.icns +0 -0
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/publish/icon.icns.svg +0 -175
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/publish/icon.ico +0 -0
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/publish/icon.png +0 -0
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/publish/icon.svg +0 -179
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/publish/notarize.cjs +0 -24
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/publish/pyproject.toml +0 -63
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/publish/setup.py +0 -43
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/resolve_upgrade_merge.sh +0 -10
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/source/__init__.py +0 -41
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/source/cambricon.js +0 -32
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/source/favicon.ico +0 -0
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/source/grapher.css +0 -602
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/source/index.html +0 -2222
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/source/modular.js +0 -81
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/source/onnx.py +0 -227
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/source/pytorch.py +0 -298
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/source/qais/qcontrol.js +0 -207
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/source/qais/qgraph-toolkit.js +0 -123
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/source/qais/qsubgraph.js +0 -226
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/source/qais/qsummary-panel.js +0 -89
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/source/server.js +0 -250
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/test/backend.py +0 -80
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/test/measures.py +0 -27
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/test/models.js +0 -359
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/test/models.json +0 -8523
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/test/worker.js +0 -859
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/armnn +0 -33
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/bigdl +0 -33
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/caffe +0 -37
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/caffe-script.js +0 -12
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/circle +0 -43
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/circle-script.js +0 -87
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/circle_script.js +0 -73
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/cntk +0 -33
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/coreml +0 -49
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/dlc +0 -20
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/dlc.fbs +0 -165
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/dnn +0 -20
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/dnn.proto +0 -79
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/executorch +0 -41
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/flatc.js +0 -1315
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/gguf +0 -22
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/kann +0 -33
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/keras +0 -62
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/keras_metadata.py +0 -205
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/keras_script.py +0 -204
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/mediapipe +0 -72
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/megengine +0 -47
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/megengine-script.js +0 -113
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/megengine_script.js +0 -112
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/mnn +0 -40
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/mslite +0 -45
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/mslite-script.js +0 -83
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/mslite_metadata.js +0 -82
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/nnabla +0 -79
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/nnabla_script.py +0 -145
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/om +0 -26
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/om.proto +0 -204
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/onnx +0 -135
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/onnx_metadata.py +0 -233
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/onnx_script.py +0 -332
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/paddle +0 -38
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/protoc.js +0 -1609
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/pytorch +0 -85
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/pytorch_metadata.py +0 -166
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/pytorch_script.py +0 -404
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/rknn +0 -20
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/rknn.fbs +0 -78
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/sentencepiece +0 -39
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/sklearn +0 -65
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/sklearn_metadata.py +0 -126
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/sklearn_script.py +0 -129
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/tf +0 -97
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/tf_metadata.py +0 -403
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/tf_script.py +0 -422
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/tflite-script.js +0 -87
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/tflite_metadata.js +0 -73
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/uff +0 -20
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/uff.proto +0 -127
- qairt_visualizer/core/ui/dist/browser/assets/netron_plugin/tools/xmodel +0 -36
- qairt_visualizer/core/ui/dist/browser/chunk-3NAQCYEU.js +0 -1
- qairt_visualizer/core/ui/dist/browser/chunk-NFKTPX3Z.js +0 -11
- qairt_visualizer/core/ui/dist/browser/chunk-OMI6HJ5Y.js +0 -19
- qairt_visualizer/core/ui/dist/browser/chunk-TTZXMRJ5.js +0 -34
- qairt_visualizer/core/ui/dist/browser/main-NXPVOKMG.js +0 -1
- qairt_visualizer/core/ui/dist/browser/worker-5VPKG2GV.js +0 -4
- qairt_visualizer/core/ui/dist/browser/worker-UVGWDZ5K.js +0 -1
- qairt_visualizer-0.5.1.dist-info/RECORD +0 -337
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/acuity-metadata.json → acuity-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/armnn-metadata.json → armnn-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/bigdl-metadata.json → bigdl-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/bigdl-proto.js → bigdl-proto.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/caffe-metadata.json → caffe-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/caffe-proto.js → caffe-proto.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/caffe2-metadata.json → caffe2-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/catboost.js → catboost.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/circle-metadata.json → circle-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/cntk-metadata.json → cntk-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/cntk-proto.js → cntk-proto.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/coreml-metadata.json → coreml-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/dl4j-metadata.json → dl4j-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/dlc-metadata.json → dlc-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/dnn-metadata.json → dnn-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/dnn-proto.js → dnn-proto.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/espresso-metadata.json → espresso-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/flexbuffers.js → flexbuffers.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/flux-metadata.json → flux-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/hailo-metadata.json → hailo-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/hdf5.js → hdf5.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/icon.png → icon.png} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/kann-metadata.json → kann-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/kann-schema.js → kann-schema.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/keras-proto.js → keras-proto.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/lasagne-metadata.json → lasagne-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/megengine-metadata.json → megengine-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/megengine-schema.js → megengine-schema.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/mlnet-metadata.json → mlnet-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/mnn-metadata.json → mnn-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/mslite-metadata.json → mslite-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/mslite-schema.js → mslite-schema.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/mxnet-metadata.json → mxnet-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/ncnn-metadata.json → ncnn-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/nnabla-metadata.json → nnabla-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/nnabla-proto.js → nnabla-proto.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/nnc.js → nnc.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/om-metadata.json → om-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/om-proto.js → om-proto.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/onednn-metadata.json → onednn-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/onnx-schema.js → onnx-schema.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/openvino-metadata.json → openvino-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/paddle-metadata.json → paddle-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/paddle-schema.js → paddle-schema.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/protobuf.js → protobuf.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/pytorch-schema.js → pytorch-schema.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/qnn-metadata.json → qnn-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/rknn-metadata.json → rknn-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/rknn-schema.js → rknn-schema.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/sentencepiece-proto.js → sentencepiece-proto.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/tengine-metadata.json → tengine-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/text.js → text.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/tflite-metadata.json → tflite-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/tflite-schema.js → tflite-schema.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/tnn-metadata.json → tnn-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/torch-metadata.json → torch-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/uff-metadata.json → uff-metadata.json} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/uff-proto.js → uff-proto.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/worker.js → worker.js} +0 -0
- /qairt_visualizer/core/ui/dist/browser/{assets/netron_plugin/source/xmodel-proto.js → xmodel-proto.js} +0 -0
- {qairt_visualizer-0.5.1.dist-info → qairt_visualizer-0.7.0.dist-info}/LICENSE.pdf +0 -0
- {qairt_visualizer-0.5.1.dist-info → qairt_visualizer-0.7.0.dist-info}/WHEEL +0 -0
- {qairt_visualizer-0.5.1.dist-info → qairt_visualizer-0.7.0.dist-info}/entry_points.txt +0 -0
- {qairt_visualizer-0.5.1.dist-info → qairt_visualizer-0.7.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import{a as W}from"./chunk-43LQFSHA.js";var l={};l.Execution=class{constructor(p){let m=this,b=m;this._sources=p||new Map,this._events=new Map,this._utf8Decoder=new TextDecoder("utf-8"),this._unresolved=new Map;let S=class extends Map{constructor(e){if(super(),e){e instanceof Map?e=Array.from(e):Array.isArray(e)||(e=Object.entries(e));for(let[t,s]of e)this.__setitem__(t,s)}}__contains__(e){return this.has(e)}__setitem__(e,t){this.set(e,t)}__getitem__(e){return this.get(e)}__delitem__(e){this.delete(e)}get(e,t){return super.get(e)||t}setdefault(e,t){if(this.has(e))return this.get(e);let s=t||null;return this.set(e,s),s}pop(e){if(this.__contains__(e)){let t=this.__getitem__(e);return this.__delitem__(e),t}return null}items(){return Array.from(this)}update(e){for(let[t,s]of e)this.set(t,s)}};this._modules=new S,this._registry=new Map;let C=class{constructor(e){this.__name__=e}},T=this.register("builtins",new C("builtins"));this.builtins=T,this._registry.set("__builtin__",T),this.registerType("builtins.type",class{constructor(...e){if(e.length===1){let[t]=e;if(t===null)return T.NoneType;if(t&&t.__class__)return t.__class__;throw new l.Error(`Unknown type '${t}'`)}if(e.length===3){let[t,s,i]=e,n=s.length>0?class extends s[0]{}:class{};b.registerType(t,n);for(let[a,o]of i)n[a]=o;return n}throw new l.Error("Invalid 'builtins.dict' argument count.")}}).__class__=T.type,this.registerType("builtins.module",C),this.registerType("builtins.method",class{}),this.registerType("builtins.function",class{constructor(e,t,s){this.__code__=e,this.__globals__=t,this.__name__=s}}),this.registerType("builtins.classmethod",class{}),this.registerType("builtins.code",class{}),this.import("builtins"),this.registerType("builtins.builtin_function_or_method",class{});let w=this.register("typing");this.typing=w;let k=this.register("operator");this.register("_codecs"),this.register("argparse"),this.enum=this.register("enum"),this.register("collections");let N=this.register("copy");this.register("copy_reg");let h=this.register("ast");this.ast=h,this.register("cuml");let L=this.register("cloudpickle"),Q=this.register("datetime");this.register("gensim");let J=this.register("io"),re=this.register("joblib"),q=this.register("jax");this.register("jax.numpy"),this.register("jax._src.array"),this.register("jax._src.device_array");let ie=this.register("functools");this.registerType("functools.partial",class{});let ne=this.register("keras"),$=this.register("catboost");this.register("lightgbm"),this.register("nolearn");let H=this.register("fastcore"),R=this.register("fastai"),oe=this.register("math");oe.inf=1/0;let z=this.register("numpy");this.register("numpy.core.multiarray"),this.register("numpy.core._multiarray_umath"),this.register("numpy.matrixlib.defmatrix");let B=this.register("pandas");this.register("pandas.indexes.base"),this.register("pandas.indexes.range"),this.register("pandas._libs.tslib"),this.register("pandas._libs.internals");let D=this.register("pickle"),Y=this.register("shap");this.register("shap.explainers.linear");let U=this.register("sklearn");this.register("sklearn.externals.joblib.numpy_pickle");let r=this.register("torch");this.torch=r;let te=this.register("torchvision"),Z=this.register("torchao");this.register("torch.storage"),this.register("torch.nn.parameter"),this.register("torch.ops"),this.register("torch._ops"),this.register("torch.ops.torchvision"),this.register("torch.ops.torchaudio"),this.register("torch.ops._caffe2"),this.register("torchvision"),this.register("__torch__");let se=this.register("sys");se.modules=this._modules,this.register("xgboost"),this.registerType("ast.AST",class{}),this.registerType("ast.mod",class extends h.AST{}),this.registerType("ast.expr",class extends h.AST{}),this.registerType("ast.unaryop",class extends h.AST{}),this.registerType("ast.binop",class extends h.AST{}),this.registerType("ast.operator",class extends h.AST{}),this.registerType("ast.boolop",class extends h.AST{}),this.registerType("ast.cmpop",class extends h.AST{}),this.registerType("ast.stmt",class extends h.AST{}),this.registerType("ast.excepthandler",class extends h.AST{}),this.registerType("ast.keyword",class extends h.AST{constructor(e,t){super(),this.arg=e,this.value=t}}),this.registerType("ast.alias",class extends h.AST{constructor(e,t){super(),this.name=e,this.asname=t}}),this.registerType("ast.Name",class extends h.expr{constructor(e,t){super(),this.id=e,t&&(this.ctx=t)}}),this.registerType("ast.Constant",class extends h.expr{constructor(e,t){super(),this.value=e,this.type=t||null}}),this.registerType("ast.Ellipsis",class extends h.Constant{constructor(){super(T.ellipsis)}}),this.registerType("ast.Starred",class extends h.expr{constructor(e,t){super(),this.value=e,t&&(this.ctx=t)}}),this.registerType("ast.List",class extends h.expr{constructor(e,t){super(),this.elts=e,t&&(this.ctx=t)}}),this.registerType("ast.Set",class extends h.expr{constructor(e){super(),this.elts=e}}),this.registerType("ast.Tuple",class extends h.expr{constructor(e,t){super(),this.elts=e,t&&(this.ctx=t)}}),this.registerType("ast.Dict",class extends h.expr{constructor(e,t){super(),this.keys=e,this.values=t}}),this.registerType("ast.ListComp",class extends h.expr{constructor(e,t){super(),this.elt=e,this.generators=t}}),this.registerType("ast.SetComp",class extends h.expr{constructor(e,t){super(),this.elt=e,this.generators=t}}),this.registerType("ast.GeneratorExp",class extends h.expr{constructor(e,t){super(),this.elt=e,this.generators=t}}),this.registerType("ast.DictComp",class extends h.expr{constructor(e,t,s){super(),this.key=e,this.value=t,this.generators=s}}),this.registerType("ast.comprehension",class extends h.AST{constructor(e,t,s,i){super(),this.target=e,this.iter=t,this.ifs=s,this.is_async=i}}),this.registerType("ast.Subscript",class extends h.expr{constructor(e,t,s){super(),this.value=e,this.slice=t,s&&(this.ctx=s)}}),this.registerType("ast.Slice",class extends h.expr{constructor(e,t,s){super(),this.lower=e,this.upper=t,this.step=s}}),this.registerType("ast.UnaryOp",class extends h.expr{constructor(e,t){super(),this.op=e,this.operand=t}}),this.registerType("ast.UAdd",class extends h.unaryop{}),this.registerType("ast.USub",class extends h.unaryop{}),this.registerType("ast.Not",class extends h.unaryop{}),this.registerType("ast.Invert",class extends h.unaryop{}),this.registerType("ast.BinOp",class extends h.expr{constructor(e,t,s){super(),this.left=e,this.op=t,this.right=s}}),this.registerType("ast.Add",class extends h.operator{}),this.registerType("ast.Sub",class extends h.operator{}),this.registerType("ast.Mult",class extends h.operator{}),this.registerType("ast.Div",class extends h.operator{}),this.registerType("ast.FloorDiv",class extends h.operator{}),this.registerType("ast.Mod",class extends h.operator{}),this.registerType("ast.Pow",class extends h.operator{}),this.registerType("ast.LShift",class extends h.operator{}),this.registerType("ast.RShift",class extends h.operator{}),this.registerType("ast.BitOr",class extends h.operator{}),this.registerType("ast.BitXor",class extends h.operator{}),this.registerType("ast.BitAnd",class extends h.operator{}),this.registerType("ast.MatMult",class extends h.operator{}),this.registerType("ast.BoolOp",class extends h.expr{constructor(e,t){super(),this.op=e,this.values=t}}),this.registerType("ast.And",class extends h.boolop{}),this.registerType("ast.Or",class extends h.boolop{}),this.registerType("ast.Compare",class extends h.expr{constructor(e,t,s){super(),this.left=e,this.ops=t,this.comparators=s}}),this.registerType("ast.Eq",class extends h.cmpop{}),this.registerType("ast.NotEq",class extends h.cmpop{}),this.registerType("ast.Lt",class extends h.cmpop{}),this.registerType("ast.LtE",class extends h.cmpop{}),this.registerType("ast.Gt",class extends h.cmpop{}),this.registerType("ast.GtE",class extends h.cmpop{}),this.registerType("ast.Is",class extends h.cmpop{}),this.registerType("ast.IsNot",class extends h.cmpop{}),this.registerType("ast.In",class extends h.cmpop{}),this.registerType("ast.NotIn",class extends h.cmpop{}),this.registerType("ast.Call",class extends h.expr{constructor(e,t,s){super(),this.func=e,this.args=t,this.keywords=s||[]}}),this.registerType("ast.Attribute",class extends h.expr{constructor(e,t,s){super(),this.value=e,this.attr=t,s&&(this.ctx=s)}}),this.registerType("ast.Lambda",class extends h.expr{constructor(e,t){super(),this.args=e,this.body=t}}),this.registerType("ast.IfExp",class extends h.expr{constructor(e,t,s){super(),this.test=e,this.body=t,this.orelse=s}}),this.registerType("ast.NamedExpr",class extends h.expr{constructor(e,t){super(),this.target=e,this.value=t}}),this.registerType("ast.Yield",class extends h.expr{constructor(e){super(),this.value=e}}),this.registerType("ast.YieldFrom",class extends h.expr{constructor(e){super(),this.value=e}}),this.registerType("ast.Expr",class extends h.stmt{constructor(e){super(),this.value=e}}),this.registerType("ast.Assign",class extends h.stmt{constructor(e,t,s){super(),this.targets=e,this.value=t,s&&(this.ctx=s)}}),this.registerType("ast.AnnAssign",class extends h.stmt{constructor(e,t,s,i){super(),this.target=e,this.annotation=t,this.value=s,this.simple=i}}),this.registerType("ast.AugAssign",class extends h.stmt{constructor(e,t,s){super(),this.target=e,this.op=t,this.value=s}}),this.registerType("ast.If",class extends h.stmt{constructor(e,t,s){super(),this.test=e,this.body=t,this.orelse=s}}),this.registerType("ast.For",class extends h.stmt{constructor(e,t,s,i){super(),this.target=e,this.iter=t,this.body=s,this.orelse=i}}),this.registerType("ast.While",class extends h.stmt{constructor(e,t,s){super(),this.test=e,this.body=t,this.orelse=s}}),this.registerType("ast.Del",class extends h.stmt{constructor(e){super(),this.targets=e}}),this.registerType("ast.Return",class extends h.stmt{constructor(e){super(),this.value=e}}),this.registerType("ast.Try",class extends h.stmt{constructor(e,t,s,i){super(),this.body=e,this.handlers=t,this.orelse=s,this.finalbody=i}}),this.registerType("ast.ExceptHandler",class extends h.excepthandler{constructor(e,t,s){super(),this.type_=e,this.name=t,this.body=s}}),this.registerType("ast.ClassDef",class extends h.stmt{constructor(e,t,s,i,n,a){super(),this.name=e,this.bases=t,this.keywords=s,this.body=i,this.decorator_list=n,this.type_params=a}}),this.registerType("ast.FunctionDef",class extends h.stmt{constructor(e,t,s,i,n,a,o){super(),this.name=e,this.args=t,this.body=s,this.decorator_list=i,this.returns=n,this.type_comment=a,this.type_params=o}}),this.registerType("ast.arguments",class extends h.AST{constructor(e,t,s,i,n,a,o){super(),this.posonlyargs=e,this.args=t,this.vararg=s,this.kwonlyargs=i,this.kw_defaults=n,this.kwarg=a,this.defaults=o}}),this.registerType("ast.arg",class extends h.AST{constructor(e,t,s){super(),this.arg=e,this.annotation=t,this.type_comment=s}}),this.registerType("ast.Import",class extends h.stmt{constructor(e){super(),this.names=e}}),this.registerType("ast.ImportFrom",class extends h.stmt{constructor(e,t,s){super(),this.module=e,this.names=t,this.level=s}}),this.registerType("ast.Assert",class extends h.stmt{constructor(e,t){super(),this.test=e,this.msg=t}}),this.registerType("ast.Raise",class extends h.stmt{constructor(e,t){super(),this.exc=e,this.cause=t}}),this.registerType("ast.With",class extends h.stmt{constructor(e,t,s){super(),this.items=e,this.body=t,this.type_comment=s}}),this.registerType("ast.withitem",class extends h.AST{constructor(e,t){super(),this.context_expr=e,this.optional_vars=t}}),this.registerType("ast.Global",class extends h.stmt{constructor(e){super(),this.names=e}}),this.registerType("ast.Nonlocal",class extends h.stmt{constructor(e){super(),this.names=e}}),this.registerType("ast.Continue",class extends h.stmt{}),this.registerType("ast.Break",class extends h.stmt{}),this.registerType("ast.Pass",class extends h.stmt{}),this.registerType("ast.Await",class extends h.stmt{constructor(e){super(),this.value=e}}),this.registerType("ast.Module",class extends h.mod{constructor(e,t){super(),this.body=e,this.type_ignores=t}}),this.registerFunction("ast.parse",(e,t,s)=>new h._Parser(e,t,s).parse()),this.registerType("ast._Parser",class{constructor(e,t,s){this._tokenizer=new h._Tokenizer(e,t),this._debug=s,h._Parser._precedence=h._Parser._precedence||{or:2,and:3,not:4,in:5,instanceof:5,is:5,"<":5,">":5,"<=":5,">=":5,"<>":5,"==":5,"!=":5,"|":6,"^":7,"&":8,"<<":9,">>":9,"+":10,"-":10,"*":11,"@":11,"/":11,"//":11,"%":11,"~":13,"**":14}}parse(){let e=this._position(),t=[];for(;!this._tokenizer.match("eof");){let i=this._parseStatement();if(i){t.push(i);continue}if(!(this._tokenizer.eat(`
|
|
2
|
+
`)||this._tokenizer.eat(";")||this._tokenizer.peek().type==="eof")&&!(this._tokenizer.eat("indent")&&this._tokenizer.peek().type==="eof"))throw new l.Error(`Unsupported statement ${this._location()}`)}let s=new h.Module(t);return this._mark(s,e),s}_parseSuite(){let e=[],t=null;if(this._tokenizer.eat(`
|
|
3
|
+
`)){if(this._tokenizer.eat("indent")){for(;!this._tokenizer.eat("eof")&&!this._tokenizer.eat("dedent");)if(!this._tokenizer.eat(";")){if(t=this._parseStatement(),t){e.push(t);continue}if(!this._tokenizer.eat(`
|
|
4
|
+
`)&&!(this._tokenizer.match("dedent")||this._tokenizer.match("eof")))throw new l.Error(`Empty statement ${this._location()}`)}}}else if(!this._tokenizer.eat("eof")){for(;!this._tokenizer.match(`
|
|
5
|
+
`)&&!this._tokenizer.match("eof")&&!this._tokenizer.match("dedent");)if(!this._tokenizer.eat(";")){if(t=this._parseStatement(),t){e.push(t);continue}throw new l.Error(`Empty statement ${this._location()}`)}this._tokenizer.eat(`
|
|
6
|
+
`)}return e}_parseStatement(){let e=null,t=this._position();if(this._eat("id","break")){let a=new h.Break;return this._mark(a,t)}if(this._eat("id","continue")){let a=new h.Continue;return this._mark(a,t)}if(this._eat("id","return")){let a=this._parseExpression(-1,[],!0),o=new h.Return(a);return this._mark(o,t)}if(this._eat("id","raise")){let a=this._parseExpression(-1,["from"]),o=null;return this._tokenizer.eat("id","from")?o=this._parseExpression():this._tokenizer.eat(",")&&(a=[a],a.push(this._parseExpression()),this._tokenizer.eat(",")&&a.push(this._parseExpression())),e=new h.Raise(a,o),this._mark(e,t)}if(this._eat("id","assert")){let a=this._parseExpression(-1,[","]),o=null;return this._tokenizer.eat(",")&&(o=this._parseExpression()),e=new h.Assert(a,o),this._mark(e,t)}if(this._eat("id","global")){let a=[];do{let c=this._parseName(!0);a.push(c.id)}while(this._tokenizer.eat(","));let o=new h.Global(a);return this._mark(o,t)}if(this._eat("id","nonlocal")){let a=[];do{let c=this._parseName(!0);a.push(c.id)}while(this._tokenizer.eat(","));let o=new h.Nonlocal(a);return this._mark(o,t)}if(this._eat("id","import")){let a=[];do{let c=this._parseDottedName(),u=null;this._tokenizer.eat("id","as")&&(u=this._parseName(!0).id);let d=new h.alias(c,u);a.push(d)}while(this._tokenizer.eat(","));let o=new h.Import(a);return this._mark(o,t)}if(this._eat("id","from")){let a=0,o=this._tokenizer.peek();o&&Array.from(o.type).every(f=>f===".")&&(this._eat(o.type),a=Array.from(o.type).length);let c=this._parseDottedName();this._tokenizer.expect("id","import");let u=[],d=this._tokenizer.eat("(");do{let f=this._parseName(!0).id,g=null;this._tokenizer.eat("id","as")&&(g=this._parseName(!0).id);let y=new h.alias(f,g);u.push(y)}while(this._tokenizer.eat(","));d&&this._tokenizer.expect(")");let _=new h.ImportFrom(c,u,a);return this._mark(_,t)}let s=this._decorator();if(t=this._position(),this._eat("id","class")){let a=this._parseName(!0),o=[];if(this._tokenizer.eat("("))for(;!this._tokenizer.eat(")");){if(this._tokenizer.eat(`
|
|
7
|
+
`))continue;let d=this._parseExpression(-1,[],!1);if(d===null)throw new l.Error(`Expected expression ${this._location()}`);if(o.push(d),!this._tokenizer.eat(",")){this._tokenizer.eat(`
|
|
8
|
+
`),this._tokenizer.expect(")");break}}this._tokenizer.expect(":");let c=this._parseSuite(),u=new h.ClassDef(a.id,o,null,c,s,null);return this._mark(u,t)}let i=this._eat("id","async")!==null;if(i&&!this._tokenizer.match("id","def")&&!this._tokenizer.match("id","with")&&!this._tokenizer.match("id","for"))throw new l.Error(`Expected 'def', 'with' or 'for' ${this._location()}`);if(this._eat("id","def")){let a=this._parseName(!0);this._tokenizer.expect("(");let o=this._parseArguments(")"),c=null;this._tokenizer.eat("->")&&(c=this._parseType()),this._tokenizer.expect(":");let u=this._parseSuite(),d=new h.FunctionDef(a.id,o,u,s,c,null,null);return i&&(d.async=i),this._mark(d,t)}if(s&&s.length>0)throw new l.Error("Unexpected decorator.");if(this._eat("id","del")){let a=this._parseExpression(-1,[],!0);return e=new h.Del(a),this._mark(e,t)}if(this._eat("id","if")){let a=this._parseExpression();this._tokenizer.expect(":");let o=this._parseSuite(),c=new h.If(a,o),u=c;for(this._tokenizer.eat(`
|
|
9
|
+
`);this._tokenizer.eat("id","elif");){let d=this._parseExpression();this._tokenizer.expect(":");let _=this._parseSuite();u.orelse=new h.If(d,_),u=u.orelse,this._tokenizer.eat(`
|
|
10
|
+
`)}return this._tokenizer.eat("id","else")&&(this._tokenizer.expect(":"),u.orelse=this._parseSuite()),this._mark(c,t)}if(this._eat("id","while")){let a=this._parseExpression();this._tokenizer.expect(":");let o=this._parseSuite(),c=null;this._tokenizer.eat("id","else")&&(this._tokenizer.expect(":"),c=this._parseSuite());let u=new h.While(a,o,c);return this._mark(u,t)}if(this._eat("id","pass")){let a=new h.Pass;return this._mark(a,t)}if(this._eat("id","for")){let a=this._parseExpression(-1,["in"]);for(;this._tokenizer.eat(",");){if(a instanceof h.Tuple||(a=new h.Tuple([a])),this._tokenizer.match("id","in")){a.elts.push({});break}a.elts.push(this._parseExpression(-1,["in"]))}this._tokenizer.expect("id","in");let o=this._parseExpression();for(;this._tokenizer.eat(",");){if(o.type!=="tuple"&&(o=new h.Tuple([o])),this._tokenizer.match(":")){o.elts.push({});break}o.elts.push(this._parseExpression(-1,["in"]))}this._tokenizer.expect(":");let c=this._parseSuite(),u=null;this._tokenizer.eat("id","else")&&(this._tokenizer.expect(":"),u=this._parseSuite());let d=new h.For(a,o,c,u);return this._mark(d,t)}if(this._eat("id","with")){let a=[];do{let u=this._parseExpression(),d=null;this._tokenizer.eat("id","as")&&(d=this._parseExpression());let _=new h.withitem(u,d);a.push(_)}while(this._tokenizer.eat(","));this._tokenizer.expect(":");let o=this._parseSuite(),c=new h.With(a,o,null);return i&&(c.async=i),this._mark(c,t)}if(this._eat("id","try")){this._tokenizer.expect(":");let a=this._parseSuite(),o=[],c=null,u=null;for(;this._tokenizer.match("id","except");){this._tokenizer.expect("id","except");let _=this._parseExpression(),f=this._tokenizer.eat("id","as")?this._parseExpression():null;this._tokenizer.expect(":");let g=this._parseSuite(),y=new h.ExceptHandler(_,f,g);o.push(y)}this._tokenizer.match("id","else")&&(this._tokenizer.expect("id","else"),this._tokenizer.expect(":"),c=this._parseSuite()),this._tokenizer.match("id","finally")&&(this._tokenizer.expect("id","finally"),this._tokenizer.expect(":"),u=this._parseSuite());let d=new h.Try(a,o,c,u);return this._mark(d,t)}let n=this._parseExpression(-1,[],!0);if(n){if(n instanceof h.Name&&this._tokenizer.eat(":")){let a=this._position(),o=this._parseExpression(-1,["="]),c=null;return this._tokenizer.eat("=")&&(c=this._parseExpression()),e=new h.AnnAssign(n,o,c,n instanceof h.Name),this._mark(e,a)}if(n instanceof h.stmt)return n;switch(n.__class__.__name__){case"AnnAssign":case"Assert":case"Assign":case"Attribute":case"AugAssign":case"Await":case"BinOp":case"Call":case"Compare":case"Constant":case"Ellipsis":case"For":case"If":case"Lambda":case"List":case"Name":case"NamedExpr":case"Raise":case"Subscript":case"Tuple":case"Yield":return new h.Expr(n);default:throw new l.Error(`Unhandled expression ${this._location()}`)}}return null}_parseExpression(e,t,s){e=e||-1;let i=new Set(t),n=[];for(;;){let a=this._position(),o=null,c=this._tokenizer.peek();if(n.length===1&&i.has(c.value))break;let u=h._Parser._precedence[c.value];if(u&&u>=e){if(this._tokenizer.read(),c.value==="not"&&this._tokenizer.eat("id","in")?c.value="not in":c.value==="is"&&this._tokenizer.eat("id","not")&&(c.value="is not"),n.length>0){let g=null;switch(c.value){case"+":g=new h.Add;break;case"-":g=new h.Sub;break;case"*":g=new h.Mult;break;case"/":g=new h.Div;break;case"//":g=new h.FloorDiv;break;case"**":g=new h.Pow;break;case"@":g=new h.MatMult;break;case"&":g=new h.BitAnd;break;case"^":g=new h.BitXor;break;case"|":g=new h.BitOr;break;case"%":g=new h.Mod;break;case">>":g=new h.RShift;break;case"<<":g=new h.LShift;break;default:break}if(g){let y=n.pop(),x=this._parseExpression(u,t,s===!0);o=new h.BinOp(y,g,x)}else{switch(c.value){case"==":g=new h.Eq;break;case"!=":g=new h.NotEq;break;case">=":g=new h.GtE;break;case"<=":g=new h.LtE;break;case"<":g=new h.Lt;break;case">":g=new h.Gt;break;case"is":g=new h.Is;break;case"is not":g=new h.IsNot;break;case"in":g=new h.In;break;case"not in":g=new h.NotIn;break;default:break}let y=n.pop(),x=this._parseExpression(u,["for","if"],s===!0);o=new h.Compare(y,[g],[x])}}else if(c.value==="*"){let g=this._parseExpression(u,t,s===!0);o=new h.Starred(g)}else if(c.value==="**"){let g=this._parseExpression(u,t,s===!0);o=new h.keyword(null,g)}else{let g=null;switch(c.value){case"-":g=new h.USub;break;case"+":g=new h.UAdd;break;case"~":g=new h.Invert;break;case"not":g=new h.Not;break;default:throw new l.Error(`Unsupported unary operator ${c.value} ${this._location()}`)}let y=this._parseExpression(u,t,s===!0);o=new h.UnaryOp(g,y),o=this._mark(o,a)}n.push(o);continue}if(this._tokenizer.eat(":=")){let g=n.pop(),y=this._parseExpression(-1,t,s!==!1),x=new h.NamedExpr(g,y);this._mark(x,a),n.push(x);continue}if(this._tokenizer.eat("=")){let g=this._position(),y=n.pop(),x=this._parseExpression(-1,t,s!==!1),F=new h.Assign([y],x);this._mark(F,g),n.push(F);continue}let d=null;switch(c.type){case"+=":d=new h.Add;break;case"-=":d=new h.Sub;break;case"**=":d=new h.Pow;break;case"*=":d=new h.Mult;break;case"//=":d=new h.FloorDiv;break;case"/=":d=new h.Div;break;case"&=":d=new h.BitAnd;break;case"%=":d=new h.Mod;break;case"^=":d=new h.BitXor;break;case"<<=":d=new h.LShift;break;case">>=":d=new h.RShift;break;case"|=":d=new h.BitOr;break;case"@=":d=new h.MatMul;break;default:break}if(d){this._tokenizer.expect(c.type);let g=n.pop(),y=this._parseExpression(-1,t,!0),x=new h.AugAssign(g,d,y);n.push(x);continue}if(a=this._position(),this._eat("id","if")){let g=n.pop(),y=this._parseExpression();this._tokenizer.expect("id","else");let x=this._parseExpression(),F=new h.IfExp(y,g,x);this._mark(F,a),n.push(F);continue}if(this._tokenizer.match("id","for")||this._tokenizer.match("id","async")){let g=this._position(),y=n.pop(),x=this._parseGenerators(),F=null;if(y instanceof h.Dict){if(y.keys.length!==1||y.values.length!==1)throw new l.Error(`Invalid dict comprehension ${this._location()}`);F=new h.DictComp(y.keys[0],y.values[0],x)}else if(y instanceof h.Set){if(y.elts.length!==1)throw new l.Error(`Invalid set comprehension ${this._location()}`);F=new h.SetComp(y.elts[0],x)}else F=new h.GeneratorExp(y,x);this._mark(F,g),n.push(F);continue}if(this._eat("id","lambda")){let g=this._parseArguments(":"),y=this._parseExpression(-1,t,!1),x=new h.Lambda(g,y);this._mark(x,a),n.push(x);continue}if(this._eat("id","yield")){if(this._tokenizer.eat("id","from")){let g=this._parseExpression(-1,[],!0);o=new h.YieldFrom(g),n.push(o)}else{let g=[];do g.push(this._parseExpression(-1,[],!1));while(this._tokenizer.eat(","));o=new h.Yield(g),n.push(o)}continue}if(this._eat("id","await")){let g=this._parseExpression(e,t,s),y=new h.Await(g);this._mark(y,a),n.push(y);continue}if(this._eat(".")){let g=n.pop(),y=this._parseName().id,x=new h.Attribute(g,y);this._mark(x,a),n.push(x);continue}if(this._tokenizer.peek().type==="("){let g=this._position(),y=[],x=[];this._tokenizer.expect("(");let F=!1;for(;!this._tokenizer.eat(")");){if(this._tokenizer.eat(`
|
|
11
|
+
`))continue;let v=this._position(),A=this._parseExpression(-1,[],!1);if(A===null)throw new l.Error(`Expected expression ${this._location()}`);if(A instanceof h.Assign&&A.targets.length===1){let[I]=A.targets;if(!(I instanceof h.Name))throw new l.Error(`Expected name ${this._location()}`);let E=new h.keyword(I.id,A.value);this._mark(E,v),x.push(E)}else y.push(A);if(this._tokenizer.eat(","))F=!0;else{this._tokenizer.eat(`
|
|
12
|
+
`),this._tokenizer.expect(")");break}}if(n.length===0&&x.length===0)o=y.length===1&&!F?y[0]:new h.Tuple(y),this._mark(o,g);else{let v=n.pop();o=new h.Call(v,y,x);let A=v;for(;A instanceof h.Attribute;)A=A.value;g.lineno=A.lineno,g.col_offset=A.col_offset,this._mark(o,g)}n.push(o);continue}if(this._tokenizer.peek().type==="["){if(n.length===0)n.push(this._parseList());else{let g=n.pop(),y=this._position(),x=this._parseSlice();o=new h.Subscript(g,x),this._mark(o,y),n.push(o)}continue}if(this._tokenizer.peek().type==="{"){let g=[],y=[],x=[];this._tokenizer.expect("{");let F=!0;for(;!this._tokenizer.eat("}");){let A=this._parseExpression(-1,[],!1);if(A===null)throw new l.Error(`Expected expression ${this._location()}`);if(this._tokenizer.eat(":")||(F=!1),F){let I=this._parseExpression(-1,["for"],!1);if(I===null)throw new l.Error(`Expected expression ${this._location()}`);if(this._eat("id","for")){if(y.length>0||x.length>0||g.length>0)throw new l.Error(`Invalid list expression ${this._location()}`);let E=this._parseExpression(-1,["in"],!0);this._tokenizer.expect("id","in");let O=this._parseExpression(-1,["for","if"],!0),M=[];for(;this._tokenizer.eat("id","if");)M.push(this._parseExpression(-1,["for","if"]));let P=[new h.comprehension(E,O,M)];return this._tokenizer.expect("}"),new h.DictComp(A,I,P)}y.push(A),x.push(I)}else g.push(A);if(this._tokenizer.eat(","),this._tokenizer.eat(`
|
|
13
|
+
`),this._tokenizer.eat("}"))break}if(y.length!==x.length||y.length>0&&g.length>0)throw new l.Error(`Invalid set expression ${this._location()}`);let v=g.length>0?new h.Set(g):new h.Dict(y,x);n.push(v);continue}let _=this._parseLiteral();if(_){if(n.length>0&&(_.type==="int"||_.type==="float"||_.type==="complex")&&(_.value.startsWith("-")||_.value.startsWith("+"))){let g=_.value<0?new h.Sub:new h.Add,y=n.pop(),x=new h.Constant(Math.abs(_.value));o=new h.BinOp(y,g,x),n.push(o)}else if(n.length===1&&_.type==="str"&&n[0]instanceof h.Constant&&typeof n[0].value=="string")n[0].value+=_.value.substring(1,_.value.length-1);else{let g=_.value;if(_.type==="int"||_.type==="float"||_.type==="complex")switch(g){case"inf":g=1/0;break;case"-inf":g=-1/0;break;default:g=Number(g);break}else if(_.type==="str")g=_.value.substring(1,_.value.length-1);else throw new l.Error(`Invalid literal ${this._location()}`);let y=new h.Constant(g,_.type);this._mark(y,a),n.push(y)}continue}if(this._eat("id","False")){let g=new h.Constant(!1,"bool");this._mark(g,a),n.push(g);continue}if(this._eat("id","True")){let g=new h.Constant(!0,"bool");this._mark(g,a),n.push(g);continue}if(this._eat("id","None")){let g=new h.Constant(null);this._mark(g,a),n.push(g);continue}if(this._tokenizer.peek().keyword)break;if(this._eat("...")){let g=new h.Ellipsis;this._mark(g,a),n.push(g);continue}let f=this._parseName();if(f){n.push(f);continue}if(s===!0&&n.length===1&&this._tokenizer.eat(",")){if(n[0]instanceof h.Tuple)[o]=n;else{let g=this._position(),y=[n.pop()];o=new h.Tuple(y),this._mark(o,g),n.push(o)}if(this._tokenizer.peek().type==="=")continue;if(!this._tokenizer.match("=")&&!i.has(this._tokenizer.peek().value)){let g=t.slice(0).concat([",","="]),y=this._parseExpression(e,g,s);if(y){o.elts.push(y);continue}}break}break}if(n.length===1)return n.pop();if(n.length!==0)throw new l.Error(`Unexpected expression ${this._location()}`);return null}_decorator(){let e=[];for(;this._tokenizer.eat("@");){let t=this._parseExpression();if(!t||!(t instanceof h.Call)&&!(t instanceof h.Name)&&!(t instanceof h.Attribute))throw new l.Error(`Invalid decorator ${this._location()}`);this._tokenizer.eat(`
|
|
14
|
+
`),e.push(t)}return e}_parseGenerators(){let e=[];for(;this._tokenizer.match("id","for")||this._tokenizer.match("id","async");){let t=this._eat("id","async")?1:0;this._tokenizer.expect("id","for");let s=this._parseExpression(-1,["in"],!0);this._tokenizer.expect("id","in");let i=this._parseExpression(-1,["for","if"],!0),n=[];for(;this._tokenizer.eat("id","if");)n.push(this._parseExpression(-1,["for","if"]));let a=new h.comprehension(s,i,n,t);e.push(a)}return e}_parseList(){let e=[];if(this._tokenizer.expect("["),!this._tokenizer.match("]")){let t=this._position(),s=this._parseExpression(-1,["for"]);if(this._tokenizer.match("id","for")){let i=this._parseGenerators();this._tokenizer.expect("]");let n=new h.ListComp(s,i);return this._mark(n,t),n}if(s===null)throw new l.Error(`Expected expression ${this._location()}`);for(e.push(s);this._tokenizer.eat(",")&&!this._tokenizer.match("]");){let i=this._parseExpression(-1,["for"]);if(!i)throw new l.Error(`Expected expression ${this._location()}`);e.push(i)}}return this._tokenizer.expect("]"),new h.List(e)}_parseSlice(){let e=[],t=[null,null,null],s=0,i=!1;for(this._tokenizer.expect("[");;)if(this._tokenizer.eat(":"))s++,i=!0;else if(s>2||this._tokenizer.match(",")||this._tokenizer.match("]")){if(!i||s>2)throw new l.Error(`Invalid slice at ${this._location()}`);if(e.push(s===0?t[0]:new h.Slice(t[0],t[1],t[2])),t=[null,null,null],s=0,this._tokenizer.eat("]"))break;this._tokenizer.expect(",")}else{let n=this._parseExpression();if(n===null)throw new l.Error(`Expected expression ${this._location()}`);t[s]=n,i=!0}return e.length>1?new h.Tuple(e):e[0]}_parseName(e){let t=this._tokenizer.peek();if(t.type==="id"&&!t.keyword){let s=this._position();this._tokenizer.read();let i=new h.Name(t.value);return this._mark(i,s)}if(e)throw new l.Error(`Invalid syntax ${this._location()}`);return null}_parseDottedName(){let e=[];do{let t=this._parseName(!0);e.push(t.id)}while(this._tokenizer.eat("."));return e.join(".")}_parseLiteral(){let e=this._tokenizer.peek();return e.type==="str"||e.type==="bool"||e.type==="int"||e.type==="float"||e.type==="complex"?(this._tokenizer.read(),e):null}_parseTypeArguments(){let e=[];for(this._tokenizer.expect("[");!this._tokenizer.eat("]");){let t=this._parseType();if(t===null)throw new l.Error(`Expected type ${this._location()}`);if(e.push(t),!this._tokenizer.eat(",")){this._tokenizer.expect("]");break}}return e}_parseType(){let e=this._parseExpression(-1,["[","="]);if(e){if(this._tokenizer.peek().value==="["){let t=this._parseList(),s=t.elts.length===1?t.elts[0]:new h.Tuple(t.elts);return new h.Subscript(e,s)}return e}return null}_parseArguments(e){let t=[],s=[],i=null,n=[],a=[],o=null,c=[],u=!1,d=!1,_=!1,f=g=>{let y=this._parseName(g);if(y){let x=e!==":"&&this._tokenizer.eat(":")?this._parseType():null;return new h.arg(y.id,x,null)}return null};for(;!this._tokenizer.eat(e);){if(this._tokenizer.eat(`
|
|
15
|
+
`),this._tokenizer.eat("/")){if(u||d||_)throw new l.Error(`Invalid '/' in arguments ${this._location()}`);u=!0}else if(this._tokenizer.eat("*")){if(d)throw new l.Error(`Multiple '*' arguments ${this._location()}`);d=!0;let g=f(!1);i=g||i}else if(this._tokenizer.eat("**")){if(_)throw new l.Error(`Multiple '**' arguments ${this._location()}`);_=!0,o=f(!0)}else{let g=f(!1);if(!g){this._tokenizer.expect(e);break}let y=this._tokenizer.eat("=")?this._parseExpression():null;if(!d&&!_)u?s.push(g):t.push(g),y!==null&&c.push(y);else if(d&&!_)n.push(g),a.push(y);else throw new l.Error(`Argument after '**' parameter ${this._location()}`)}if(this._tokenizer.eat(`
|
|
16
|
+
`),!this._tokenizer.eat(",")){this._tokenizer.expect(e);break}}return u||(s=t.concat(s),t=[]),new h.arguments(t,s,i,n,a,o,c)}_eat(e,t){if(this._tokenizer.match(e,t)){let s=this._position();return this._tokenizer.expect(e,t),s}return null}_mark(e,t){return e.filename=t.filename,e.lineno=t.lineno,e.col_offset=t.col_offset,e.end_lineno=this._tokenizer.lineno,e.end_col_offset=this._tokenizer.col_offset,e}_position(){return{filename:this._tokenizer.filename,lineno:this._tokenizer.lineno,col_offset:this._tokenizer.col_offset}}_location(){return this._tokenizer.location()}}),this.registerType("ast._Tokenizer",class{constructor(e,t){if(this._text=e,this.filename=t,this.linepos=0,this.lineno=1,this._position=0,this._token={type:"",value:""},this._brackets=0,this._indentation=[],this._outdent=0,!h._Tokenizer._whitespace){h._Tokenizer._whitespace=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;let s="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",i="\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u0620-\u0649\u0672-\u06D3\u06E7-\u06E8\u06FB-\u06FC\u0730-\u074A\u0800-\u0814\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0840-\u0857\u08E4-\u08FE\u0900-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09D7\u09DF-\u09E0\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5F-\u0B60\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C01-\u0C03\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62-\u0C63\u0C66-\u0C6F\u0C82\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2-\u0CE3\u0CE6-\u0CEF\u0D02\u0D03\u0D46-\u0D48\u0D57\u0D62-\u0D63\u0D66-\u0D6F\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E34-\u0E3A\u0E40-\u0E45\u0E50-\u0E59\u0EB4-\u0EB9\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F41-\u0F47\u0F71-\u0F84\u0F86-\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1029\u1040-\u1049\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u170E-\u1710\u1720-\u1730\u1740-\u1750\u1772\u1773\u1780-\u17B2\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1920-\u192B\u1930-\u193B\u1951-\u196D\u19B0-\u19C0\u19C8-\u19C9\u19D0-\u19D9\u1A00-\u1A15\u1A20-\u1A53\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1B46-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C00-\u1C22\u1C40-\u1C49\u1C5B-\u1C7D\u1CD0-\u1CD2\u1D00-\u1DBE\u1E01-\u1F15\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2D81-\u2D96\u2DE0-\u2DFF\u3021-\u3028\u3099\u309A\uA640-\uA66D\uA674-\uA67D\uA69F\uA6F0-\uA6F1\uA7F8-\uA800\uA806\uA80B\uA823-\uA827\uA880-\uA881\uA8B4-\uA8C4\uA8D0-\uA8D9\uA8F3-\uA8F7\uA900-\uA909\uA926-\uA92D\uA930-\uA945\uA980-\uA983\uA9B3-\uA9C0\uAA00-\uAA27\uAA40-\uAA41\uAA4C-\uAA4D\uAA50-\uAA59\uAA7B\uAAE0-\uAAE9\uAAF2-\uAAF3\uABC0-\uABE1\uABEC\uABED\uABF0-\uABF9\uFB20-\uFB28\uFE00-\uFE0F\uFE20-\uFE26\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F";h._Tokenizer._identifierStart=new RegExp(`[${s}]`),h._Tokenizer._identifierChar=new RegExp(`[${s}${i}]`)}}peek(){return this._cache||(this._tokenize(),this._cache=!0),this._token}read(){this._cache||this._tokenize();let e=this._position+this._token.value.length;for(;this._position<e;)h._Tokenizer._isNewline(this._get(this._position))?(this._position=this._newLine(this._position),this.linepos=this._position,this.lineno++):this._position++;return this._cache=!1,this._token}match(e,t){let s=this.peek();return s.type===e&&(!t||s.value===t)}eat(e,t){let s=this.peek();return s.type===e&&(!t||s.value===t)?(this.read(),!0):!1}expect(e,t){let s=this.peek();if(s.type!==e)throw new l.Error(`Unexpected '${s.value}' instead of '${e}' ${this.location()}`);if(t&&s.value!==t)throw new l.Error(`Unexpected '${s.value}' instead of '${t}' ${this.location()}`);this.read()}location(){return`at ${this.filename}:${this.lineno}:${this.col_offset}.`}get col_offset(){return this._position-this.linepos+1}static _isSpace(e){return e===" "||e===" "||e==="\v"||e==="\f"||e==="\xA0"?!0:e.charCodeAt(0)>=5760?h._Tokenizer._whitespace.test(e):!1}static _isNewline(e){switch(e){case`
|
|
17
|
+
`:case"\r":case"\u2028":case"\u2029":return!0;default:return!1}}static _isIdentifierStartChar(e){return e<"A"?e==="$":e<="Z"?!0:e<"a"?e==="_":e<="z"?!0:e.charCodeAt(0)>=170?h._Tokenizer._identifierStart.test(e):!1}static _isIdentifierChar(e){return e<"0"?e==="$":e<="9"?!0:e<"A"?!1:e<="Z"?!0:e<"a"?e==="_":e<="z"?!0:e.charCodeAt(0)>=170?h._Tokenizer._identifierChar.test(e):!1}_get(e){return e>=this._text.length?"\0":this._text[e]}_skipLine(){for(;this._position<this._text.length&&!h._Tokenizer._isNewline(this._get(this._position));)this._position++}_skipWhitespace(){for(;this._position<this._text.length;){let e=this._text[this._position];if(e==="#")this._skipLine();else if(h._Tokenizer._isSpace(e))this._position++;else if(e==="\\")if(this._position++,h._Tokenizer._isNewline(this._get(this._position)))this._position=this._newLine(this._position),this.linepos=this._position,this.lineno+=1;else throw new l.Error(`Unexpected '${this._text[this._position]}' after line continuation ${this.location()}`);else if(this._brackets>0&&h._Tokenizer._isNewline(e))this._position=this._newLine(this._position),this.linepos=this._position,this.lineno+=1;else break}}_newLine(e){return this._get(e)===`
|
|
18
|
+
`&&this._get(e+1)==="\r"||this._get(e)==="\r"&&this._get(e+1)===`
|
|
19
|
+
`?e+2:e+1}_tokenize(){if(this._token.type!==`
|
|
20
|
+
`&&this._skipWhitespace(),this._token.type==="dedent"&&(this._indentation.pop(),this._outdent--,this._outdent>0)){this._token={type:"dedent",value:""};return}if(this._token.type===`
|
|
21
|
+
`){let s="",i=this._position;for(;i<this._text.length;){let a=this._text[i];if(h._Tokenizer._isSpace(a))s+=a,i++;else if(h._Tokenizer._isNewline(a))s="",i=this._newLine(i),this._position=i,this.linepos=i,this.lineno+=1;else if(a==="#"){for(s="";i<this._text.length&&!h._Tokenizer._isNewline(this._text[i]);)i++;continue}else break}let n=null;if(s.length>0){let a=this._indentation.length>0?this._indentation[this._indentation.length-1]:"";if(s.length>a.length)n="indent",this._indentation.push(s);else if(s.length>0&&s.length<a.length){n="dedent",this._outdent=0;for(let o=this._indentation.length-1;o>=0&&s.length<this._indentation[o].length;o--)this._outdent++}else this._position+=s.length}else if(i>=this._text.length){this._token={type:"eof",value:""};return}else this._indentation.length>0&&(n="dedent",this._outdent=this._indentation.length);if(n==="indent"||n==="dedent"){this._token={type:n,value:s};return}}if(this._position>=this._text.length){this._token={type:"eof",value:""};return}let e=this._get(this._position),t=this._string();if(t){this._token=t;return}switch(e){case"(":case"[":case"{":this._brackets++,this._token={type:e,value:e};return;case")":case"]":case"}":if(this._brackets===0)throw new l.Error(`Unexpected '${e}' ${this.location}`);this._brackets--,this._token={type:e,value:e};return;case",":case";":case"?":this._token={type:e,value:e};return;default:{let s=this._number();if(s){this._token=s;return}if(e==="."){let a=this._position+1;for(;this._get(a)===".";)a++;let o=this._text.substring(this._position,a);this._token={type:o,value:o};return}let i=this._identifier();if(i){this._token=i;return}let n=this._operator();if(n){this._token=n;return}break}}if(e==="."){this._token={type:e,value:e};return}if(e==="\\"){this._token={type:"\\",value:e};return}if(h._Tokenizer._isNewline(e)){this._token={type:`
|
|
22
|
+
`,value:this._text.substring(this._position,this._newLine(this._position))};return}throw new l.Error(`Unexpected token '${e}' ${this.location()}`)}_number(){let e=u=>u>="0"&&u<="7"||u==="_",t=u=>u==="0"||u==="1"||u==="_",s=u=>u>="0"&&u<="9"||u==="_",i=u=>s(u)||u>="a"&&u<="f"||u>="A"&&u<="F"||u==="_",n=this._get(this._position),a=n==="-"||n==="+"?1:0,o=this._position+a;if(n=this._get(o),n==="0"){let u=0,d=this._get(o+1);if((d==="x"||d==="X")&&i(this._get(o+2))){for(o+=2;i(this._get(o));)o+=1;(this._get(o)==="l"||this._get(o)==="L")&&(o+=1),u=16}else if((d==="b"||d==="B")&&t(this._get(o+2))){for(o+=2;t(this._get(o));)o++;u=2}else if((d==="o"||d==="O")&&e(this._get(o+2))){for(o+=2;e(this._get(o));)o++;u=8}else if(d>="0"&&d<="7"){for(o++;e(this._get(o));)o+=1;(this._get(o)==="l"||this._get(o)==="L")&&(o+=1),u=8}if(u>0&&this._get(o)!=="."){let _=this._text.substring(this._position,o),f=_.indexOf("_")===-1?_:_.split("_").join("");if(!isNaN(parseInt(f,u)))return{type:"int",value:_}}}o=this._position+a;let c=!1;if(this._get(o)>="1"&&this._get(o)<="9"){for(;s(this._get(o));)o++;n=this._get(o).toLowerCase(),c=n!=="."&&n!=="e"}if(this._get(o)==="0"&&(o++,n=this._get(o).toLowerCase(),c=!s(n)&&n!=="."&&n!=="e"&&n!=="j"),c){if(this._get(o)==="j"||this._get(o)==="J"||this._get(o)==="l"||this._get(o)==="L")return{type:"complex",value:this._text.substring(this._position,o+1)};let u=this._text.substring(this._position,o);if(!isNaN(parseInt(u,10)))return{type:"int",value:u}}if(o=this._position+a,this._get(o)>="0"&&this._get(o)<="9"||this._get(o)==="."&&this._get(o+1)>="0"&&this._get(o+1)<="9"){for(;s(this._get(o));)o++;for(this._get(o)==="."&&o++;s(this._get(o));)o++;if(o>this._position+a)if(this._get(o)==="e"||this._get(o)==="E")if(o++,(this._get(o)==="-"||this._get(o)==="+")&&o++,s(this._get(o)))for(;s(this._get(o));)o++;else o=this._position;else for(;s(this._get(o));)o++;if(o>this._position+a){if(this._get(o)==="j"||this._get(o)==="J")return{type:"complex",value:this._text.substring(this._position,o+1)};let u=this._text.substring(this._position,o),d=u.indexOf("_")===-1?u:u.split("_").join("");if(!isNaN(parseFloat(d)))return{type:"float",value:u}}}return null}_identifier(){let e=this._position;if(h._Tokenizer._isIdentifierStartChar(this._get(e)))for(e++;h._Tokenizer._isIdentifierChar(this._get(e));)e++;if(e>this._position){let t=this._text.substring(this._position,e),s=!1;switch(t){case"and":case"as":case"else":case"For":case"If":case"Import":case"in":case"is":case"not":case"or":s=!0;break;default:break}return{type:"id",value:t,keyword:s}}return null}_operator(){let e=0,t=this._get(this._position),s=this._get(this._position+1),i=this._get(this._position+2);switch(t){case"+":case"&":case"|":case"^":case"=":case"!":case"%":case"~":e=s==="="?2:1;break;case"-":e=s==="="||s===">"?2:1;break;case"*":switch(s){case"*":e=i==="="?3:2;break;case"=":e=2;break;default:e=1;break}break;case"/":switch(s){case"/":e=i==="="?3:2;break;case"=":e=2;break;default:e=1;break}break;case"<":switch(s){case">":e=2;break;case"<":e=i==="="?3:2;break;case"=":e=2;break;default:e=1;break}break;case">":switch(s){case">":e=i==="="?3:2;break;case"=":e=2;break;default:e=1;break}break;case"@":e=s==="="?2:1;break;case":":e=s==="="?2:1;break;default:return null}let n=this._text.substring(this._position,this._position+e);return{type:n,value:n}}_string(){let e=this._position,t=-1;if(this._get(e)==="'"||this._get(e)==='"')t="";else if(this._get(e+1)==="'"||this._get(e+1)==='"'){let s=this._get(e),i=s.toLowerCase();(i==="b"||i==="f"||i==="r"||i==="u")&&(t=s)}else if(this._get(e+2)==="'"||this._get(e+2)==='"'){let s=this._text.substring(this._position,this._position+2),i=s.toLowerCase();(i==="br"||i==="fr"||i==="rb"||i==="rf"||i==="ur")&&(t=s)}if(t.length>=0){e+=t.length;let s="",i=0,n=this._get(e),a=this._get(e+1),o=this._get(e+2);switch(n){case"'":s=n,i=a==="'"&&o==="'"?3:1;break;case'"':s=n,i=a==='"'&&o==='"'?3:1;break;default:throw new l.Error(`Unsupported string quote '${n}'.`)}if(e+=i,i===1)for(;e<this._text.length;){if(this._text[e]===s)return{type:"str",value:this._text.substring(this._position,e+1)};if(this._text[e]==="\\"&&(this._get(e+1)===s||this._get(e+1)===`
|
|
23
|
+
`||this._get(e+1)==="\\"))e+=2;else{if(this._text[e]==="\r"||this._text[e]===`
|
|
24
|
+
`)break;e++}}else if(i===3)for(;e<this._text.length;){if(this._get(e)===s&&this._get(e+1)===s&&this._get(e+2)===s)return{type:"str",value:this._text.substring(this._position,e+3)};if(this._get(e)==="\\"&&this._get(e+1)===s){e+=2;continue}e++}}if(e=this._position,this._get(e)==="`")for(e++;e<this._text.length;){if(this._text[e]==="`")return{type:"str",value:this._text.substring(this._position,e+1)};e++}return null}}),this.registerType("builtins.dict",S),this.registerType("builtins.ellipsis",class{}),this.registerType("builtins.cell",class{}),this.registerType("builtins.list",class extends Array{}),this.registerType("builtins.number",class{}),this.registerFunction("builtins.__import__",(e,t,s,i,n)=>b.__import__(e,t,s,i,n)),this.registerType("builtins.bool",class extends Boolean{constructor(e){e&&e.__bool__?e=e.__bool__():e&&e.__len__?e=e.__len__()>0:e=!!e,super(e)}}),this.registerType("builtins.int",class extends Number{constructor(e){e&&e.__int__?e=e.__int__():Number.isInteger(e)||(e=NaN),super(e)}}),this.registerType("builtins.float",class extends Number{constructor(e){e&&e.__float__?e=e.__float__():Number(e)!==e&&(e=NaN),super(e)}}),this.registerType("builtins.long",class extends Number{constructor(e){e&&e.__int__?e=e.__int__():Number.isInteger(e)||(e=NaN),super(e)}}),this.registerType("builtins.str",class extends String{constructor(e){e&&e.__str__?e=e.__str__():typeof e!="string"&&(e=JSON.stringify(e)),super(e)}}),this.registerType("builtins.complex",class{constructor(e,t){this.real=e,this.imag=t}}),this.registerType("builtins.NoneType",class{}),this.registerType("builtins.object",class{static __new__(e,...t){return b.invoke(e,t)}static __setattr__(e,t,s){T.setattr(e,t,s)}}),this.registerType("builtins.tuple",class extends Array{constructor(e){if(super(e?e.length:0),e)for(let t=0;t<e.length;t++)this[t]=e[t]}}),this.registerType("builtins.staticmethod",class{}),this.registerType("builtins.Warning",class{}),this.registerType("builtins.FutureWarning",class extends T.Warning{}),this.registerType("builtins.BaseException",class{}),this.registerType("builtins.Exception",class extends T.BaseException{}),this.registerType("builtins.AttributeError",class extends T.Exception{}),this.registerType("builtins.SyntaxError",class extends T.Exception{}),this.registerFunction("builtins.print",()=>{}),this.registerFunction("builtins.unicode"),T.Ellipsis=new T.ellipsis,this.registerType("typing._Final",class{}),this.registerType("typing._SpecialForm",class extends w._Final{}),this.registerType("typing._BaseGenericAlias",class extends w._Final{}),this.registerType("typing._GenericAlias",class extends w._BaseGenericAlias{}),this.registerType("typing._SpecialGenericAlias",class extends w._BaseGenericAlias{}),this.registerType("typing._TupleType",class extends w._SpecialGenericAlias{}),this.registerType("typing._CallableType",class{}),this.registerFunction("typing.cast"),w.Any=Reflect.construct(w._SpecialForm,[]),w.Callable=Reflect.construct(w._CallableType,[]),w.Dict=Reflect.construct(w._SpecialGenericAlias,[]),w.List=Reflect.construct(w._SpecialGenericAlias,[]),w.Optional=Reflect.construct(w._SpecialForm,[]),w.OrderedDict=Reflect.construct(w._SpecialGenericAlias,[]),w.Sequence=Reflect.construct(w._SpecialGenericAlias,[]),w.Tuple=Reflect.construct(w._TupleType,[]),w.Union=Reflect.construct(w._SpecialForm,[]),this.registerType("enum.Enum",class{}),this.registerFunction("operator.add"),this.registerFunction("operator.eq"),this.registerFunction("operator.ge"),this.registerFunction("operator.getitem"),this.registerFunction("operator.gt"),this.registerFunction("operator.mul"),this.registerFunction("operator.mod"),this.registerFunction("operator.le"),this.registerFunction("operator.lt"),this.registerFunction("operator.ne"),this.registerFunction("operator.floordiv"),this.registerFunction("operator.sub"),this.registerFunction("sys.path.append",()=>{}),this.registerFunction("sys.path.insert",()=>{}),this.registerType("argparse.Namespace",class{constructor(e){this.args=e}}),this.registerType("catboost._catboost._CatBoost",class{_deserialize_model(){}}),this.registerType("catboost.core._CatBoostBase",class{constructor(){this._object=new $._catboost._CatBoost}__setstate__(e){for(let[t,s]of e){if(t==="__model"){this._load_from_string(s);continue}this[t]=s}}_load_from_string(e){this._deserialize_model(e)}_deserialize_model(e){this._object._deserialize_model(e)}}),this.registerType("catboost.core.CatBoost",class extends $.core._CatBoostBase{load_model(){throw new l.Error("'catboost.core.CatBoostClassifier.load_model' not implemented.")}}),this.registerType("catboost.core.CatBoostClassifier",class extends $.core.CatBoost{}),this.registerType("catboost.core.CatBoostRegressor",class extends $.core.CatBoost{}),$.CatBoostClassifier=$.core.CatBoostClassifier,$.CatBoostRegressor=$.core.CatBoostRegressor,$.CatBoost=$.core.CatBoost,this.registerType("collections.deque",class extends Array{constructor(e){if(super(),Array.isArray(e))for(let t of e)this.push(t)}}),this.registerType("collections.OrderedDict",class extends S{}),this.registerType("cuml.common.array_descriptor.CumlArrayDescriptorMeta",class{}),this.registerType("cuml.ensemble.randomforestclassifier.RandomForestClassifier",class{}),this.registerType("cuml.internals.array.CumlArray",class{}),this.registerType("cuml.internals.mem_type.MemoryType",class{}),this.registerType("cuml.raft.common.handle.Handle",class{__setstate__(e){this._handle=e}}),this.registerType("cuml.svm.svr.SVR",class{}),this.registerType("datetime.date",class{}),this.registerType("datetime.datetime",class extends Q.date{}),this.registerType("datetime.timedelta",class{}),this.registerType("datetime.tzinfo",class{}),this.registerType("datetime.timezone",class extends Q.tzinfo{}),this.registerType("dnnlib.tflib.network.Network",class{}),this.registerType("dnnlib.util.EasyDict",class extends S{}),this.registerType("haiku._src.data_structures.FlatMapping",class{constructor(e){Object.assign(this,e)}}),this.registerType("haiku._src.data_structures.frozendict",class{constructor(e){Object.assign(this,e)}}),this.registerType("hmmlearn.hmm.GaussianHMM",class{}),this.registerType("hmmlearn.hmm.GMMHMM",class{}),this.registerType("hmmlearn.hmm.MultinomialHMM",class{}),this.registerType("hmmlearn.base.ConvergenceMonitor",class{}),this.registerType("io.BytesIO",class{constructor(e,t){this.mode=t||"r",this._buf=this.mode==="w"?null:e,this._point=0}seek(e){this._buf.seek&&this._buf.seek(e),this._point=e}read(e,t){if(this._buf.stream&&t)return this._buf.stream(e);if(this._buf.peek)return this._buf.read(e);if(this._buf instanceof Uint8Array){let s=this._point;return this._point=e===void 0?this._buf.length:s+e,this._buf.subarray(s,this._point)}throw new l.Error("Unsupported buffer type.")}write(e){let t=this._buf||new Uint8Array;this._point=t.length+e.length,this._buf=new Uint8Array(this._point),this._buf.set(t,0),this._buf.set(e,t.length)}getbuffer(){return new T.memoryview(this._buf)}}),this.registerType("io.StringIO",class{constructor(){this._buf=[]}write(e){this._buf.push(e)}toString(){return this._buf.join("")}}),this.registerType("numpy.dtype",class{constructor(e,t,s){switch(typeof e=="string"&&(e.startsWith("<")||e.startsWith(">")||e.startsWith("|"))?(this.byteorder=e.substring(0,1),e=e.substring(1)):this.byteorder="=",e){case"b1":case"bool":this.itemsize=1,this.kind="b";break;case"i1":case"int8":this.itemsize=1,this.kind="i";break;case"i2":case"int16":this.itemsize=2,this.kind="i";break;case"i4":case"int32":this.itemsize=4,this.kind="i";break;case"i8":case"int64":case"int":this.itemsize=8,this.kind="i";break;case"u1":case"uint8":this.itemsize=1,this.kind="u";break;case"u2":case"uint16":this.itemsize=2,this.kind="u";break;case"u4":case"uint32":this.itemsize=4,this.kind="u";break;case"u8":case"uint64":case"uint":this.itemsize=8,this.kind="u";break;case"f1":case"float8_e5m2":this.itemsize=1,this.kind="f";break;case"f2":case"float16":this.itemsize=2,this.kind="f";break;case"f4":case"float32":this.itemsize=4,this.kind="f";break;case"f8":case"float64":case"float":this.itemsize=8,this.kind="f";break;case"c8":case"complex64":this.itemsize=8,this.kind="c";break;case"c16":case"complex128":case"complex":this.itemsize=16,this.kind="c";break;case"M8":case"M":this.itemsize=8,this.kind="M";break;case"V":case"void":this.itemsize=0,this.kind="V";break;default:if(e.startsWith("V"))this.itemsize=parseInt(e.substring(1),10),this.kind="V";else if(e.startsWith("O"))this.itemsize=e==="O"?8:parseInt(e.substring(1),10),this.kind="O";else if(e.startsWith("S"))this.itemsize=parseInt(e.substring(1),10),this.kind="S";else if(e.startsWith("U"))this.kind="U",this.itemsize=4*parseInt(e.substring(1),10);else if(e.startsWith("T"))this.kind="T",this.itemsize=parseInt(e.substring(1),10);else throw new l.Error(`Unsupported dtype '${e}'.`);break}t&&(this.align=t),s&&(this.copy=s)}get str(){return(this.byteorder==="="?"<":this.byteorder)+this.kind+this.itemsize.toString()}get name(){switch(this.kind){case"V":return`void${this.itemsize===0?"":this.itemsize*8}`;case"S":return`bytes${this.itemsize===0?"":this.itemsize*8}`;case"U":return`str${this.itemsize===0?"":this.itemsize*8}`;case"T":return`StringDType${this.itemsize===0?"":this.itemsize*8}`;case"M":return"datetime64";case"b":return"bool";default:return this.__name__}}__setstate__(e){switch(e.length){case 8:[this.version,this.byteorder,this.subarray,this.names,this.fields,this.elsize,this.alignment,this.int_dtypeflags]=e;break;case 9:[this.version,this.byteorder,this.subarray,this.names,this.fields,this.elsize,this.alignment,this.int_dtypeflags,this.metadata]=e;break;default:throw new l.Error(`Unsupported numpy.dtype setstate length '${e.length}'.`)}}get __name__(){switch(this.kind){case"b":switch(this.itemsize){case 1:return"boolean";default:throw new l.Error(`Unsupported boolean itemsize '${this.itemsize}'.`)}case"i":switch(this.itemsize){case 1:return"int8";case 2:return"int16";case 4:return"int32";case 8:return"int64";default:throw new l.Error(`Unsupported int itemsize '${this.itemsize}'.`)}case"u":switch(this.itemsize){case 1:return"uint8";case 2:return"uint16";case 4:return"uint32";case 8:return"uint64";default:throw new l.Error(`Unsupported uint itemsize '${this.itemsize}'.`)}case"f":switch(this.itemsize){case 1:return"float8e5m2";case 2:return"float16";case 4:return"float32";case 8:return"float64";default:throw new l.Error(`Unsupported float itemsize '${this.itemsize}'.`)}case"c":switch(this.itemsize){case 8:return"complex64";case 16:return"complex128";default:throw new l.Error(`Unsupported complex itemsize '${this.itemsize}'.`)}case"S":case"T":return"string";case"U":return"string";case"M":return"datetime";case"O":return"object";case"V":return"void";default:throw new l.Error(`Unsupported dtype kind '${this.kind}'.`)}}}),this.registerType("numpy.generic",class{}),this.registerType("numpy.inexact",class{}),this.registerType("numpy.bool_",class extends z.generic{}),this.registerType("numpy.number",class extends z.generic{}),this.registerType("numpy.integer",class extends z.number{}),this.registerType("numpy.floating",class extends z.inexact{}),this.registerType("numpy.float16",class extends z.floating{}),this.registerType("numpy.float32",class extends z.floating{}),this.registerType("numpy.float64",class extends z.floating{}),this.registerType("numpy.signedinteger",class extends z.integer{}),this.registerType("numpy.int8",class extends z.signedinteger{}),this.registerType("numpy.int16",class extends z.signedinteger{}),this.registerType("numpy.int32",class extends z.signedinteger{}),this.registerType("numpy.int64",class extends z.signedinteger{}),this.registerType("numpy.unsignedinteger",class extends z.integer{}),this.registerType("numpy.uint8",class extends z.unsignedinteger{}),this.registerType("numpy.uint16",class extends z.unsignedinteger{}),this.registerType("numpy.uint32",class extends z.unsignedinteger{}),this.registerType("numpy.uint64",class extends z.unsignedinteger{}),this.registerType("numpy.datetime64",class extends z.generic{}),this.registerType("numpy.dtypes.StringDType",class extends z.dtype{constructor(){super("|T16")}}),this.registerType("gensim.models.doc2vec.Doctag",class{}),this.registerType("gensim.models.doc2vec.Doc2Vec",class{}),this.registerType("gensim.models.doc2vec.Doc2VecTrainables",class{}),this.registerType("gensim.models.doc2vec.Doc2VecVocab",class{}),this.registerType("gensim.models.fasttext.FastText",class{}),this.registerType("gensim.models.fasttext.FastTextTrainables",class{}),this.registerType("gensim.models.fasttext.FastTextVocab",class{}),this.registerType("gensim.models.fasttext.FastTextKeyedVectors",class{}),this.registerType("gensim.models.keyedvectors.Doc2VecKeyedVectors",class{}),this.registerType("gensim.models.keyedvectors.FastTextKeyedVectors",class{}),this.registerType("gensim.models.keyedvectors.KeyedVectors",class{}),this.registerType("gensim.models.keyedvectors.Vocab",class{}),this.registerType("gensim.models.keyedvectors.Word2VecKeyedVectors",class{}),this.registerType("gensim.models.ldamodel.LdaState",class{}),this.registerType("gensim.models.ldamulticore.LdaMulticore",class{}),this.registerFunction("gensim.models.phrases.original_scorer"),this.registerType("gensim.models.phrases.Phraser",class{}),this.registerType("gensim.models.phrases.Phrases",class{}),this.registerType("gensim.models.tfidfmodel.TfidfModel",class{}),this.registerType("gensim.models.word2vec.Vocab",class{}),this.registerType("gensim.models.word2vec.Word2Vec",class{}),this.registerType("gensim.models.word2vec.Word2VecTrainables",class{}),this.registerType("gensim.models.word2vec.Word2VecVocab",class{}),this.registerFunction("gensim.models.tfidfmodel.df2idf"),this.registerFunction("gensim.utils.call_on_class_only",()=>{throw new T.AttributeError("This method should be called on a class object.")}),this.registerFunction("gensim.utils.identity"),this.registerType("google3.learning.deepmind.research.nbr.pbl_jax.clean_jaxline.utils.optimizers.ScaleByLarsState",class{constructor(e){Object.assign(this,e)}}),this.registerType("joblib._store_backends.FileSystemStoreBackend",class{}),this.registerType("joblib.memory.NotMemorizedFunc",class{}),this.registerType("joblib.numpy_pickle.NumpyArrayWrapper",class{__read__(e){if(this.dtype.__name__==="object")return e.load();if(this.numpy_array_alignment_bytes){let[s]=e.read(1);e.read(s)}if(this.order==="F")throw new l.Error("Fortran order not implemented.");let t=this.dtype.itemsize*this.shape.reduce((s,i)=>s*i,1);return this.data=e.read(t),b.invoke(this.subclass,[this.shape,this.dtype,this.data])}}),this.registerType("joblib.numpy_pickle.NDArrayWrapper",class{__setstate__(e){this.subclass=e.get("subclass"),this.filename=e.get("state"),this.allow_mmap=e.get("allow_mmap")}__read__(){return this}}),U.externals.joblib.numpy_pickle.NDArrayWrapper=re.numpy_pickle.NDArrayWrapper,U.externals.joblib.numpy_pickle.NumpyArrayWrapper=re.numpy_pickle.NumpyArrayWrapper,this.registerType("keras.engine.sequential.Sequential",class{}),this.registerType("keras.src.legacy.preprocessing.text.Tokenizer",class{}),this.registerType("lasagne.layers.conv.Conv2DLayer",class{}),this.registerType("lasagne.layers.dense.DenseLayer",class{}),this.registerType("lasagne.layers.input.InputLayer",class{}),this.registerType("lasagne.layers.pool.MaxPool2DLayer",class{}),this.registerType("lightgbm.sklearn.LGBMRegressor",class{}),this.registerType("lightgbm.sklearn.LGBMClassifier",class{}),this.registerType("lightgbm.basic.Booster",class{constructor(){this.average_output=!1,this.models=[],this.loaded_parameter=""}__setstate__(e){let t=e.get("_handle",e.get("handle",null));if(t){this.LoadModelFromString(t);return}for(let[s,i]of e)this[s]=i}LoadModelFromString(e){let t=e.split(`
|
|
25
|
+
`),s=t.shift()||"?";if(s.trim()!=="tree")throw new l.Error(`Invalid signature '${s.trim()}'.`);let i=new Map;for(;t.length>0&&!t[0].startsWith("Tree=");){let d=t.shift().trim();if(d.length>0){let _=d.split("=");if(_.length===1)i.set(_[0],"");else if(_.length===2)i.set(_[0],_[1]);else if(_.length>2)if(_[0]==="feature_names")i.set(_[0],d.substring(14));else if(_[0]==="monotone_constraints")i.set(_[0],d.substring(21));else throw new l.Error(`Wrong line: ${d.substring(0,Math.min(128,d.length))}`)}}let n=(d,_)=>{if(i.has(d))return parseInt(i.get(d),10);if(_!==void 0)return _;throw new l.Error(`Model file does not specify ${d}.`)},a=(d,_)=>{if(i.has(d)){let f=i.get(d).split(" ");if(f.length!==_)throw new l.Error(`Wrong size of ${d}.`);return f}throw new l.Error(`Model file does not contain ${d}.`)};this.version=i.get("version")||"",this.num_class=n("num_class"),this.num_tree_per_iteration=n("num_tree_per_iteration",this.num_class),this.label_index=n("label_index"),this.max_feature_idx=n("max_feature_idx"),i.has("average_output")&&(this.average_output=!0),this.feature_names=a("feature_names",this.max_feature_idx+1),this.feature_infos=a("feature_infos",this.max_feature_idx+1),i.has("monotone_constraints")&&(this.monotone_constraints=a("monotone_constraints",this.max_feature_idx+1)),i.has("objective")&&(this.objective=i.get("objective"));let o=null;for(;t.length>0;){let _=t.shift().trim();if(_.length===0)continue;if(_.startsWith("Tree=")){o={index:parseInt(_.split("=").pop(),10)},this.models.push(o);continue}if(_==="end of trees")break;let f=_.split("=");if(f.length!==2)throw new l.Error(`Invalid property '${_}'.`);let g=f[0].trim(),y=f[1].trim();o[g]=y}let c=[],u=!1;for(;t.length>0;){let _=t.shift().trim();if(_==="parameters:"){u=!0;continue}else{if(_==="end of parameters")break;u&&c.push(_)}}c.length>0&&(this.loaded_parameter=c.join(`
|
|
26
|
+
`))}}),this.registerFunction("megengine.functional.elemwise.clip",()=>{}),this.registerFunction("megengine.functional.elemwise.sqrt",()=>{}),this.registerFunction("megengine.functional.nn.conv2d",()=>{}),this.registerFunction("megengine.functional.nn.relu",()=>{}),this.registerFunction("megengine.functional.nn.sigmoid",()=>{}),this.registerFunction("megengine.functional.tensor.arange",()=>{}),this.registerFunction("megengine.functional.tensor.broadcast_to",()=>{}),this.registerFunction("megengine.functional.tensor.concat",()=>{}),this.registerFunction("megengine.functional.tensor.expand_dims",()=>{}),this.registerFunction("megengine.functional.tensor.flatten",()=>{}),this.registerFunction("megengine.functional.tensor.full",()=>{}),this.registerFunction("megengine.functional.tensor.reshape",()=>{}),this.registerFunction("megengine.functional.tensor.split",()=>{}),this.registerFunction("megengine.functional.tensor.stack",()=>{}),this.registerFunction("megengine.functional.tensor.transpose",()=>{}),this.registerFunction("megengine.functional.vision.interpolate",()=>{}),this.registerFunction("megengine.module.qat.module.QATModule._apply_fakequant_with_observer",()=>{}),this.registerType("megengine.core._imperative_rt.common.CompNode",class{}),this.registerType("megengine.core._imperative_rt.ops.ElemwiseMultiType",class{}),this.registerType("megengine.core._imperative_rt.ops.FakeQuant",class{}),this.registerType("megengine.core._imperative_rt.ops.GetVarShape",class{}),this.registerType("megengine.core._imperative_rt.ops.Resize",class{}),this.registerType("megengine.core.ops._internal.param_defs.ConvolutionV0.Mode",class{}),this.registerType("megengine.core.ops._internal.param_defs.Convolution.ComputeMode",class{}),this.registerType("megengine.distributed.group.Group",class{}),this.registerType("megengine.module.activation.ReLU",class{}),this.registerType("megengine.module.activation.Softmax",class{}),this.registerType("megengine.module.adaptive_pooling.AdaptiveAvgPool2d",class{}),this.registerType("megengine.module.batchnorm.BatchNorm1d",class{}),this.registerType("megengine.module.batchnorm.BatchNorm2d",class{}),this.registerType("megengine.module.conv.Conv2d",class{}),this.registerType("megengine.module.conv.ConvTranspose2d",class{}),this.registerType("megengine.module.conv_bn.ConvBn2d",class{}),this.registerType("megengine.module.dropout.Dropout",class{}),this.registerType("megengine.module.identity.Identity",class{}),this.registerType("megengine.module.linear.Linear",class{}),this.registerType("megengine.module.module.Module",class{}),this.registerType("megengine.module.normalization.InstanceNorm",class{}),this.registerType("megengine.module.normalization.GroupNorm",class{}),this.registerType("megengine.module.normalization.LayerNorm",class{}),this.registerType("megengine.module.pooling.AvgPool2d",class{}),this.registerType("megengine.module.pooling.MaxPool2d",class{}),this.registerType("megengine.module.qat.concat.Concat",class{}),this.registerType("megengine.module.qat.elemwise.Elemwise",class{}),this.registerType("megengine.module.sequential.Sequential",class{}),this.registerType("megengine.quantization.fake_quant.FakeQuantize",class{}),this.registerType("megengine.quantization.fake_quant.LSQ",class{}),this.registerType("megengine.quantization.fake_quant.TQT",class{}),this.registerType("megengine.quantization.utils.QParams",class{}),this.registerType("megengine.quantization.utils.QuantMode",class{}),this.registerType("megengine.quantization.observer.ExponentialMovingAverageObserver",class{}),this.registerType("megengine.quantization.observer.HistogramObserver",class{}),this.registerType("megengine.quantization.observer.MinMaxObserver",class{}),this.registerType("megengine.quantization.observer.PassiveObserver",class{}),this.registerType("megengine.quantization.observer.SyncExponentialMovingAverageObserver",class{}),this.registerType("megengine.quantization.observer.SyncMinMaxObserver",class{}),this.registerType("megengine.traced_module.expr.Apply",class{}),this.registerType("megengine.traced_module.expr.CallFunction",class{}),this.registerType("megengine.traced_module.expr.CallMethod",class{}),this.registerType("megengine.traced_module.expr.Constant",class{}),this.registerType("megengine.traced_module.expr.GetAttr",class{}),this.registerType("megengine.traced_module.expr.Input",class{}),this.registerType("megengine.traced_module.fake_quant.FakeQuantize",class{}),this.registerType("megengine.traced_module.node.ModuleNode",class{}),this.registerType("megengine.traced_module.node.NodeMixin",class{}),this.registerType("megengine.traced_module.node.TensorNode",class{}),this.registerType("megengine.traced_module.pytree.ArgsIndex",class{}),this.registerType("megengine.traced_module.serialization._ModuleState",class{}),this.registerType("megengine.traced_module.traced_module.InternalGraph",class{}),this.registerType("megengine.traced_module.traced_module.NameSpace",class{}),this.registerType("megengine.traced_module.traced_module.TracedModule",class{}),this.registerType("megengine.tensor.Parameter",class{constructor(e,t,s){this.data=e,this.dtype=t,this.device=s}}),this.registerType("megengine.traced_module.pytree.TreeDef",class{toString(){let e="";for(let t of this.children_defs)e+=`${t},`;return typeof this.type=="string"?`${this.type.split(".").slice(-1)}(${e})`:`${this.type.__name__}(${e})`}}),this.registerType("megengine.traced_module.pytree.LeafDef",class{toString(){let e="";this.const_val===null?e+="[":e+=this.const_val;for(let t of Object.values(this.type))e+=t.__name__;return e+="]",e}}),this.registerType("megengine.tensor.Tensor",class{constructor(e,t,s){this.data=e,this.dtype=t,this.device=s}}),this.registerType("megengine.core.tensor.dtype.QuantDtypeMeta",class{constructor(e,t,s,i,n,a){this.name=e,this.cname=t,this.np_dtype=s,this.qmin=i,this.qmax=n,this.is_signed=a}}),this.registerType("nolearn.lasagne.base.BatchIterator",class{}),this.registerType("nolearn.lasagne.base.Layers",class{}),this.registerType("nolearn.lasagne.base.NeuralNet",class{}),this.registerType("nolearn.lasagne.base.TrainSplit",class{}),this.registerType("nolearn.lasagne.handlers.PrintLayerInfo",class{}),this.registerType("nolearn.lasagne.handlers.PrintLog",class{}),this.registerType("numpy.ndarray",class{constructor(e,t,s,i,n,a){this.shape=e,this.dtype=t,this.data=s===void 0?null:s,this.offset=i===void 0?0:i,this._strides=n===void 0?null:n,this.order=a===void 0?null:a,this.flags={},this._read()}static __new__(e,t,s,i,n,a,o){return new e(t,s,i,n,a,o)}__setstate__(e){[this.version,this.shape,this.dtype,this.flags.fn,this.data]=e,this._read()}flatten(){let e=this.shape.reduce((s,i)=>s*i,1),t=new z.ndarray([e],this.dtype,this.data,this.offset,this.strides,this.order);return t.flags=this.flags,t}reshape(e,t){return new z.ndarray(e,this.dtype,this.data,this.offset,this.strides,t)}tobytes(){return this.data}tolist(){if(this.shape.length<0||this.shape.length>1)throw new l.Error(`Unsupported shape '${JSON.stringify(this.shape)}'.`);let e=this.shape.reduce((s,i)=>s*i,1),t=new Array(e);switch(this.dtype.kind){case"U":{let s=new Uint32Array(new Uint8Array(this.data).buffer),i=this.dtype.itemsize>>2,n=0;for(let a=0;a<e;a++){let o=s.subarray(n,n+i),c=o.indexOf(0);t[a]=Array.from(c>=0?o.subarray(0,c):o).map(u=>String.fromCodePoint(u)).join(""),n+=i}return t}case"S":{let s=this.data,i=this.dtype.itemsize,n=new TextDecoder("utf-8"),a=0;for(let o=0;o<e;o++){let c=s.subarray(a,a+i),u=c.indexOf(0);t[o]=n.decode(u>=0?c.subarray(0,u):c),a+=i}return t}case"V":{let s=this.data,i=this.dtype.itemsize,n=0;for(let a=0;a<e;a++)t[a]=s.slice(n,n+i),n+=i;return t}case"T":return this.data;case"O":return this.data;default:throw new l.Error(`Type kind '${this.dtype.kind}' not implemented.`)}}get itemsize(){return this.dtype.itemsize}get size(){return(this.shape||[]).reduce((e,t)=>e*t,1)}get strides(){if(!this._strides){let e=this.shape,t=new Array(e.length),s=this.itemsize;for(let i=e.length-1;i>=0;i--)t[i]=s,s*=e[i];return t}return this._strides}_read(){if(this.data){let e=this.dtype.itemsize*this.size;if(typeof this.data=="string"){if(this.data=this._unescape(this.data,e),this.data.length!==e)throw new l.Error("Invalid string array data size.")}else this.data.length}}_unescape(e,t){let s=e.length,i=new Uint8Array(s);if(t&&t===s){for(let o=0;o<t;o++)i[o]=e.charCodeAt(o);return i}let n=0,a=0;for(;n<s;){let o=e.charCodeAt(n++);if(o!==92||n>=s)i[a++]=o;else switch(o=e.charCodeAt(n++),o){case 39:i[a++]=39;break;case 92:i[a++]=92;break;case 34:i[a++]=34;break;case 114:i[a++]=13;break;case 110:i[a++]=10;break;case 116:i[a++]=9;break;case 98:i[a++]=8;break;case 88:case 120:{let c=n-1,u=a;for(let d=0;d<2;d++){if(n>=s){n=c,a=u,i[a]=92;break}let _=e.charCodeAt(n++);if(_>=65&&_<=70?_-=55:_>=97&&_<=102?_-=87:_>=48&&_<=57?_-=48:_=-1,_===-1){n=c,a=u,i[a]=92;break}i[a]=i[a]<<4|_}a++;break}default:if(o<48||o>57)i[a++]=92,i[a++]=o;else{n--;let c=n,u=a;for(let d=0;d<3;d++){if(n>=s){n=c,a=u,i[a]=92;break}let _=e.charCodeAt(n++);if(_<48||_>57){n=c,a=u,i[a]=92;break}i[a]=i[a]<<3|_-48}a++}break}}return i.slice(0,a)}}),this.registerType("numpy.matrix",class extends z.ndarray{static __new__(){throw new l.Error("'numpy.matrix.__new__' not implemented.")}}),z.matrixlib.defmatrix.matrix=z.matrix,this.registerType("numpy.ma.core.MaskedArray",class extends z.ndarray{constructor(e){super(e.shape,e.dtype,e.data)}}),this.registerType("numpy.core.memmap.memmap",class extends z.ndarray{}),this.registerType("pandas.core.arrays.categorical.Categorical",class{}),this.registerType("pandas.core.arrays.datetimes.DatetimeArray",class{}),this.registerType("pandas.core.arrays.integer.IntegerArray",class{}),this.registerType("pandas.core.generic.Flags",class{}),this.registerType("pandas.core.generic.NDFrame",class{constructor(e){this._internal_names=["_mgr","_item_cache","_cache","_name","_metadata","_flags"],this._metadata=[],T.object.__setattr__(m,"_mgr",e),T.object.__setattr__(m,"_attrs",{}),T.object.__setattr__(m,"_flags",new B.core.generic.Flags(this,!0))}__setstate__(e){if(e instanceof B.core.internals.managers.BlockManager)this._mgr=e;else if(e instanceof T.dict)if(e.__contains__("_data")&&!e.__contains__("_mgr")&&e.__setitem__("_mgr",e.pop("_data")),e.get("_typ")){let s=e.get("_attrs",new T.dict);s||(s=new T.dict),T.object.__setattr__(this,"_attrs",s);let i=e.get("_flags",new T.dict({allows_duplicate_labels:!0}));T.object.__setattr__(this,"_flags",new B.core.generic.Flags(this,i));let n=new T.set(this._internal_names.concat(this._metadata));for(let a of n)if(e.__contains__(a)&&a!=="_flags"){let o=e.__getitem__(a);T.object.__setattr__(this,a,o)}for(let[a,o]of e)n.has(a)||T.object.__setattr__(this,a,o)}else throw new l.Error("Pre-0.12 pickles are no longer supported.");else if(e.size===2)throw new l.Error("Pre-0.12 pickles are no longer supported.")}}),this.registerType("pandas.core.frame.DataFrame",class extends B.core.generic.NDFrame{}),this.registerFunction("pandas.core.indexes.base._new_Index",(e,t)=>new e(t)),this.registerType("pandas.core.indexes.datetimes._new_DatetimeIndex",class{}),this.registerType("pandas.core.indexes.datetimes.DatetimeIndex",class{}),this.registerType("pandas.core.indexes.base.Index",class{}),this.registerType("pandas.core.indexes.range.RangeIndex",class{}),this.registerType("pandas.core.indexes.multi.MultiIndex",class{}),this.registerType("pandas.core.indexes.numeric.Int64Index",class{}),this.registerType("pandas.core.index.Int64Index",class{}),this.registerFunction("pandas.core.internals.blocks.Block",class{}),this.registerFunction("pandas.core.internals.blocks.NumpyBlock",class extends B.core.internals.blocks.Block{}),this.registerFunction("pandas.core.internals.blocks.get_block_type",()=>B.core.internals.blocks.NumpyBlock),this.registerFunction("pandas.core.internals.blocks.maybe_coerce_values",e=>e),this.registerFunction("pandas.core.internals.blocks.new_block",(e,t,s,i)=>{let n=b.invoke("pandas.core.internals.blocks.get_block_type",[e.dtype]);return new n(e,s,t,i)}),this.registerType("pandas.core.internals.managers.SingleBlockManager",class{}),this.registerType("pandas.core.internals.managers.BlockManager",class{}),this.registerType("pandas.core.series.Series",class{}),this.registerFunction("pandas._libs.arrays.__pyx_unpickle_NDArrayBacked"),this.registerFunction("pandas._libs.internals._unpickle_block",(e,t,s)=>(e=b.invoke("pandas.core.internals.blocks.maybe_coerce_values",[e]),b.invoke("pandas.core.internals.blocks.new_block",[e,t,s]))),this.registerType("pandas._libs.tslibs.base.ABCTimestamp",class extends Q.datetime{}),this.registerType("pandas._libs.tslibs.offsets.BaseOffset",class{}),this.registerType("pandas._libs.tslibs.offsets.SingleConstructorOffset",class extends B._libs.tslibs.offsets.BaseOffset{}),this.registerType("pandas._libs.tslibs.offsets.Tick",class extends B._libs.tslibs.offsets.SingleConstructorOffset{}),this.registerType("pandas._libs.tslibs.offsets.Day",class extends B._libs.tslibs.offsets.Tick{}),this.registerType("pandas._libs.tslibs.offsets.Minute",class extends Q.datetime{}),this.registerFunction("pandas._libs.tslibs.timestamps._unpickle_timestamp"),this.registerType("pandas._libs.tslibs.timestamps._Timestamp",class extends B._libs.tslibs.base.ABCTimestamp{}),this.registerType("pandas._libs.tslibs.timestamps.Timestamp",class extends B._libs.tslibs.timestamps._Timestamp{}),B.indexes.base._new_Index=B.core.indexes.base._new_Index,B.indexes.base.Index=B.core.indexes.base.Index,B.indexes.range.RangeIndex=B.core.indexes.range.RangeIndex,B.core.index.Index=B.core.indexes.base.Index,B.core.index._new_Index=B.core.indexes.base._new_Index,B.core.internals.BlockManager=B.core.internals.managers.BlockManager,B._libs.tslib.Timestamp=B._libs.tslibs.timestamps.Timestamp,this.registerType("pathlib.Path",class{}),this.registerType("pathlib._local.PosixPath",class{}),this.registerType("pathlib._local.WindowsPath",class{});let ee=this.register("pathlib");ee.PosixPath=ee._local.PosixPath,ee.WindowsPath=ee._local.WindowsPath,this.registerType("shap._serializable.Serializable",class{}),this.registerType("shap.explainers._explainer.Explainer",class extends Y._serializable.Serializable{}),this.registerType("shap.explainers._linear.LinearExplainer",class extends Y.explainers._explainer.Explainer{}),Y.explainers.LinearExplainer=Y.explainers._linear.LinearExplainer,Y.explainers.linear.LinearExplainer=Y.explainers._linear.LinearExplainer,this.registerType("sklearn._loss.link.BaseLink",class{}),this.registerType("sklearn._loss._loss.__pyx_unpickle_CyHalfBinomialLoss",class{}),this.registerType("sklearn._loss._loss.__pyx_unpickle_CyHalfMultinomialLoss",class{}),this.registerType("sklearn._loss._loss.CyLossFunction",class{}),this.registerType("sklearn._loss._loss.CyHalfBinomialLoss",class{}),this.registerType("sklearn._loss._loss.CyHalfMultinomialLoss",class{}),this.registerType("sklearn._loss._loss.CyHalfSquaredError",class extends U._loss._loss.CyLossFunction{}),this.registerType("sklearn._loss.link.IdentityLink",class extends U._loss.link.BaseLink{}),this.registerType("sklearn._loss.link.Interval",class{}),this.registerType("sklearn._loss.link.LogitLink",class{}),this.registerType("sklearn._loss.link.MultinomialLogit",class extends U._loss.link.BaseLink{}),this.registerFunction("sklearn._loss._loss.__pyx_unpickle_CyHalfSquaredError"),this.registerType("sklearn._loss.loss.BaseLoss",class{}),this.registerType("sklearn._loss.loss.HalfBinomialLoss",class{}),this.registerType("sklearn._loss.loss.HalfMultinomialLoss",class extends U._loss.loss.BaseLoss{}),this.registerType("sklearn._loss.loss.HalfSquaredError",class extends U._loss.loss.BaseLoss{}),this.registerType("sklearn.base.BaseEstimator",class{}),this.registerType("sklearn.base.TransformerMixin",class{}),this.registerType("sklearn.calibration._CalibratedClassifier",class{}),this.registerType("sklearn.calibration._SigmoidCalibration",class{}),this.registerType("sklearn.calibration.CalibratedClassifierCV",class{}),this.registerType("sklearn.cluster._agglomerative.FeatureAgglomeration",class{}),this.registerType("sklearn.cluster._dbscan.DBSCAN",class{}),this.registerType("sklearn.cluster._kmeans.KMeans",class{}),this.registerType("sklearn.cluster._kmeans.MiniBatchKMeans",class{}),this.registerType("sklearn.cluster.k_means_.MiniBatchKMeans",class{}),this.registerType("sklearn.compose._column_transformer._RemainderColsList",class{}),this.registerType("sklearn.compose._column_transformer.ColumnTransformer",class{}),this.registerType("sklearn.compose._column_transformer.make_column_selector",class{}),this.registerType("sklearn.compose._target.TransformedTargetRegressor",class{}),this.registerType("sklearn.cross_decomposition._pls.PLSRegression",class{}),this.registerType("sklearn.decomposition._fastica.FastICA",class{}),this.registerType("sklearn.decomposition._incremental_pca.IncrementalPCA",class{}),this.registerType("sklearn.decomposition._pca.PCA",class{}),this.registerType("sklearn.decomposition._truncated_svd.TruncatedSVD",class{}),this.registerType("sklearn.decomposition.pca.PCA",class{}),this.registerType("sklearn.decomposition.PCA",class{}),this.registerType("sklearn.decomposition.truncated_svd.TruncatedSVD",class{}),this.registerType("sklearn.discriminant_analysis.LinearDiscriminantAnalysis",class{}),this.registerType("sklearn.discriminant_analysis.QuadraticDiscriminantAnalysis",class{}),this.registerType("sklearn.dummy.DummyClassifier",class{}),this.registerType("sklearn.dummy.DummyRegressor",class{}),this.registerType("sklearn.ensemble._bagging.BaggingClassifier",class{}),this.registerType("sklearn.ensemble._bagging.BaggingRegressor",class{}),this.registerType("sklearn.ensemble._forest.RandomForestClassifier",class{}),this.registerType("sklearn.ensemble._forest.RandomForestRegressor",class{}),this.registerType("sklearn.ensemble._forest.ExtraTreesClassifier",class{}),this.registerType("sklearn.ensemble._forest.ExtraTreesRegressor",class{}),this.registerType("sklearn.ensemble._gb_losses.BinomialDeviance",class{}),this.registerType("sklearn.ensemble._gb_losses.ExponentialLoss",class{}),this.registerType("sklearn.ensemble._gb_losses.LeastAbsoluteError",class{}),this.registerType("sklearn.ensemble._gb_losses.LeastSquaresError",class{}),this.registerType("sklearn.ensemble._gb_losses.MultinomialDeviance",class{}),this.registerType("sklearn.ensemble._gb.GradientBoostingClassifier",class{}),this.registerType("sklearn.ensemble._gb.GradientBoostingRegressor",class{}),this.registerType("sklearn.ensemble._hist_gradient_boosting.binning._BinMapper",class{}),this.registerType("sklearn.ensemble._hist_gradient_boosting.gradient_boosting.HistGradientBoostingRegressor",class{}),this.registerType("sklearn.ensemble._hist_gradient_boosting.loss.LeastSquares",class{}),this.registerType("sklearn.ensemble._hist_gradient_boosting.predictor.TreePredictor",class{}),this.registerType("sklearn.ensemble._iforest.IsolationForest",class{}),this.registerType("sklearn.ensemble._stacking.StackingClassifier",class{}),this.registerType("sklearn.ensemble._stacking.StackingRegressor",class{}),this.registerType("sklearn.ensemble._voting.VotingClassifier",class{}),this.registerType("sklearn.ensemble._voting.VotingRegressor",class{}),this.registerType("sklearn.ensemble._weight_boosting.AdaBoostClassifier",class{}),this.registerType("sklearn.ensemble._weight_boosting.AdaBoostRegressor",class{}),this.registerType("sklearn.ensemble.forest.RandomForestClassifier",class{}),this.registerType("sklearn.ensemble.forest.RandomForestRegressor",class{}),this.registerType("sklearn.ensemble.forest.ExtraTreesClassifier",class{}),this.registerType("sklearn.ensemble.gradient_boosting.BinomialDeviance",class{}),this.registerType("sklearn.ensemble.gradient_boosting.GradientBoostingClassifier",class{}),this.registerType("sklearn.ensemble.gradient_boosting.LogOddsEstimator",class{}),this.registerType("sklearn.ensemble.gradient_boosting.MultinomialDeviance",class{}),this.registerType("sklearn.ensemble.gradient_boosting.PriorProbabilityEstimator",class{}),this.registerType("sklearn.ensemble.voting_classifier.VotingClassifier",class{}),this.registerType("sklearn.ensemble.weight_boosting.AdaBoostClassifier",class{}),this.registerType("sklearn.feature_extraction._dict_vectorizer.DictVectorizer",class{}),this.registerType("sklearn.feature_extraction._hashing.FeatureHasher",class{}),this.registerType("sklearn.feature_extraction.text.CountVectorizer",class{}),this.registerType("sklearn.feature_extraction.text.HashingVectorizer",class{}),this.registerType("sklearn.feature_extraction.text.TfidfTransformer",class{}),this.registerType("sklearn.feature_extraction.text.TfidfVectorizer",class{}),this.registerType("sklearn.feature_selection._from_model.SelectFromModel",class{}),this.registerFunction("sklearn.feature_selection._mutual_info.mutual_info_classif"),this.registerFunction("sklearn.feature_selection._univariate_selection.chi2"),this.registerType("sklearn.feature_selection._univariate_selection.GenericUnivariateSelect",class{}),this.registerType("sklearn.feature_selection._univariate_selection.SelectKBest",class{}),this.registerType("sklearn.feature_selection._univariate_selection.SelectPercentile",class{}),this.registerType("sklearn.feature_selection._variance_threshold.VarianceThreshold",class{}),this.registerType("sklearn.feature_selection._rfe.RFE",class{}),this.registerType("sklearn.feature_selection._rfe.RFECV",class extends U.feature_selection._rfe.RFE{}),this.registerType("sklearn.feature_selection.univariate_selection.SelectKBest",class{}),this.registerType("sklearn.feature_selection.variance_threshold.VarianceThreshold",class{}),this.registerType("sklearn.gaussian_process._gpc.GaussianProcessClassifier",class{}),this.registerType("sklearn.gaussian_process._gpr.GaussianProcessRegressor",class{}),this.registerType("sklearn.gaussian_process.gpc.GaussianProcessClassifier",class{}),this.registerType("sklearn.gaussian_process.kernels.ConstantKernel",class{}),this.registerType("sklearn.gaussian_process.kernels.DotProduct",class{}),this.registerType("sklearn.gaussian_process.kernels.Product",class{}),this.registerType("sklearn.gaussian_process.kernels.RBF",class{}),this.registerType("sklearn.gaussian_process.kernels.Sum",class{}),this.registerType("sklearn.gaussian_process.kernels.WhiteKernel",class{}),this.registerType("sklearn.grid_search._CVScoreTuple",class{}),this.registerType("sklearn.grid_search.GridSearchCV",class{}),this.registerType("sklearn.impute._base.SimpleImputer",class{}),this.registerType("sklearn.impute._iterative.IterativeImputer",class{}),this.registerType("sklearn.impute._iterative._ImputerTriplet",class{}),this.registerType("sklearn.impute.SimpleImputer",class{}),this.registerType("sklearn.isotonic.IsotonicRegression",class{}),this.registerType("sklearn.kernel_ridge.KernelRidge",class{}),this.registerType("sklearn.linear_model._base.LinearRegression",class{}),this.registerType("sklearn.linear_model._bayes.BayesianRidge",class{}),this.registerType("sklearn.linear_model._coordinate_descent.ElasticNetCV",class{}),this.registerType("sklearn.linear_model._coordinate_descent.ElasticNet",class{}),this.registerType("sklearn.linear_model._coordinate_descent.Lasso",class{}),this.registerType("sklearn.linear_model._least_angle.LassoLarsCV",class{}),this.registerType("sklearn.linear_model._logistic.LogisticRegression",class{}),this.registerType("sklearn.linear_model._logistic.LogisticRegressionCV",class{}),this.registerType("sklearn.linear_model._quantile.QuantileRegressor",class{}),this.registerType("sklearn.linear_model._ridge.Ridge",class{}),this.registerType("sklearn.linear_model._ridge.RidgeClassifier",class{}),this.registerType("sklearn.linear_model._ridge.RidgeClassifierCV",class{}),this.registerType("sklearn.linear_model._sgd_fast.Hinge",class{}),this.registerType("sklearn.linear_model._sgd_fast.Log",class{}),this.registerType("sklearn.linear_model._sgd_fast.ModifiedHuber",class{}),this.registerType("sklearn.linear_model._sgd_fast.SquaredHinge",class{}),this.registerType("sklearn.linear_model._stochastic_gradient.SGDClassifier",class{}),this.registerType("sklearn.linear_model._stochastic_gradient.SGDRegressor",class{}),this.registerType("sklearn.linear_model.base.LinearRegression",class{}),this.registerType("sklearn.linear_model.sgd_fast.Hinge",class{}),this.registerType("sklearn.linear_model.LogisticRegression",class{}),this.registerType("sklearn.linear_model.logistic.LogisticRegression",class{}),this.registerType("sklearn.linear_model.logistic.LogisticRegressionCV",class{}),this.registerType("sklearn.linear_model.LassoLars\u200B",class{}),this.registerType("sklearn.linear_model.ridge.Ridge",class{}),this.registerType("sklearn.linear_model.sgd_fast.Log",class{}),this.registerType("sklearn.linear_model.stochastic_gradient.SGDClassifier",class{}),this.registerType("sklearn.manifold._t_sne.TSNE",class{}),this.registerType("sklearn.metrics._dist_metrics.DistanceMetric",class extends T.object{}),this.registerType("sklearn.metrics._dist_metrics.DistanceMetric32",class extends U.metrics._dist_metrics.DistanceMetric{}),this.registerType("sklearn.metrics._dist_metrics.DistanceMetric64",class extends U.metrics._dist_metrics.DistanceMetric{}),this.registerType("sklearn.metrics._dist_metrics.EuclideanDistance",class extends U.metrics._dist_metrics.DistanceMetric{}),this.registerType("sklearn.metrics._dist_metrics.EuclideanDistance32",class extends U.metrics._dist_metrics.DistanceMetric32{}),this.registerType("sklearn.metrics._dist_metrics.EuclideanDistance64",class extends U.metrics._dist_metrics.DistanceMetric64{}),this.registerType("sklearn.metrics._dist_metrics.ManhattanDistance",class extends U.metrics._dist_metrics.DistanceMetric{}),this.registerType("sklearn.metrics._dist_metrics.ManhattanDistance64",class extends U.metrics._dist_metrics.DistanceMetric64{}),this.registerType("sklearn.metrics._scorer._PassthroughScorer",class{}),this.registerType("sklearn.metrics._scorer._PredictScorer",class{}),this.registerType("sklearn.metrics.scorer._PredictScorer",class{}),this.registerType("sklearn.metrics._scorer._ThresholdScorer",class{}),this.registerType("sklearn.mixture._bayesian_mixture.BayesianGaussianMixture",class{}),this.registerType("sklearn.mixture._gaussian_mixture.GaussianMixture",class{}),this.registerType("sklearn.model_selection._search.GridSearchCV",class{}),this.registerType("sklearn.model_selection._search.RandomizedSearchCV",class{}),this.registerType("sklearn.model_selection._split.KFold",class{}),this.registerType("sklearn.model_selection._split.RepeatedKFold",class{}),this.registerType("sklearn.model_selection._split.StratifiedKFold",class{}),this.registerType("sklearn.model_selection._split.StratifiedShuffleSplit",class{}),this.registerType("sklearn.model_selection._split.TimeSeriesSplit",class{}),this.registerType("sklearn.multiclass.OneVsRestClassifier",class{}),this.registerType("sklearn.multioutput.ClassifierChain",class{}),this.registerType("sklearn.multioutput.MultiOutputClassifier",class{}),this.registerType("sklearn.multioutput.MultiOutputRegressor",class{}),this.registerType("sklearn.naive_bayes.BernoulliNB",class{}),this.registerType("sklearn.naive_bayes.ComplementNB",class{}),this.registerType("sklearn.naive_bayes.GaussianNB",class{}),this.registerType("sklearn.naive_bayes.MultinomialNB",class{}),this.registerType("sklearn.neighbors.ball_tree.BallTree",class{}),this.registerFunction("sklearn.neighbors.ball_tree.newObj",e=>e.__new__(e)),this.registerType("sklearn.neighbors._classification.KNeighborsClassifier",class{}),this.registerFunction("sklearn.neighbors._dist_metrics.newObj"),this.registerType("sklearn.neighbors._dist_metrics.EuclideanDistance",class{}),this.registerType("sklearn.neighbors._kd_tree.BinaryTree64",class extends T.object{}),this.registerType("sklearn.neighbors._kd_tree.KDTree64",class extends U.neighbors._kd_tree.BinaryTree64{}),this.registerType("sklearn.neighbors._kd_tree.KDTree",class extends U.neighbors._kd_tree.KDTree64{}),this.registerFunction("sklearn.neighbors._kd_tree.newObj",e=>e.__new__(e)),this.registerType("sklearn.neighbors._regression.KNeighborsRegressor",class{}),this.registerType("sklearn.neighbors._unsupervised.NearestNeighbors",class{}),this.registerType("sklearn.neighbors.classification.KNeighborsClassifier",class{}),this.registerFunction("sklearn.neighbors.dist_metrics.newObj",e=>e.__new__(e)),this.registerType("sklearn.neighbors.dist_metrics.EuclideanDistance",class{}),this.registerFunction("sklearn.neighbors.kd_tree.newObj",e=>e.__new__(e)),this.registerType("sklearn.neighbors.kd_tree.KDTree",class{}),this.registerType("sklearn.neighbors.KNeighborsClassifier",class{}),this.registerType("sklearn.neighbors.KNeighborsRegressor",class{}),this.registerType("sklearn.neighbors.regression.KNeighborsRegressor",class{}),this.registerType("sklearn.neighbors.unsupervised.NearestNeighbors",class{}),this.registerType("sklearn.neural_network._multilayer_perceptron.MLPClassifier",class{}),this.registerType("sklearn.neural_network._multilayer_perceptron.MLPRegressor",class{}),this.registerType("sklearn.neural_network._stochastic_optimizers.AdamOptimizer",class{}),this.registerType("sklearn.neural_network._stochastic_optimizers.SGDOptimizer",class{}),this.registerType("sklearn.neural_network.rbm.BernoulliRBM",class{}),this.registerType("sklearn.neural_network.multilayer_perceptron.MLPClassifier",class{}),this.registerType("sklearn.neural_network.multilayer_perceptron.MLPRegressor",class{}),this.registerType("sklearn.neural_network.stochastic_gradient.SGDClassifier",class{}),this.registerType("sklearn.pipeline.Pipeline",class{}),this.registerType("sklearn.pipeline.FeatureUnion",class{}),this.registerType("sklearn.preprocessing._data.MinMaxScaler",class{}),this.registerType("sklearn.preprocessing._data.MaxAbsScaler",class{}),this.registerType("sklearn.preprocessing._data.Normalizer",class{}),this.registerType("sklearn.preprocessing._data.PolynomialFeatures",class{}),this.registerType("sklearn.preprocessing._data.PowerTransformer",class{}),this.registerType("sklearn.preprocessing._data.QuantileTransformer",class{}),this.registerType("sklearn.preprocessing._data.RobustScaler",class{}),this.registerType("sklearn.preprocessing._data.StandardScaler",class{}),this.registerType("sklearn.preprocessing._discretization.KBinsDiscretizer",class{}),this.registerType("sklearn.preprocessing._encoders.OneHotEncoder",class{}),this.registerType("sklearn.preprocessing._encoders.OrdinalEncoder",class{}),this.registerType("sklearn.preprocessing._function_transformer.FunctionTransformer",class{}),this.registerType("sklearn.preprocessing._label.LabelBinarizer",class{}),this.registerType("sklearn.preprocessing._label.LabelEncoder",class{}),this.registerType("sklearn.preprocessing._label.MultiLabelBinarizer",class{}),this.registerType("sklearn.preprocessing._polynomial.PolynomialFeatures",class{}),this.registerType("sklearn.preprocessing.data.Binarizer",class{}),this.registerType("sklearn.preprocessing.data.MaxAbsScaler",class{}),this.registerType("sklearn.preprocessing.data.MinMaxScaler",class{}),this.registerType("sklearn.preprocessing.data.Normalizer",class{}),this.registerType("sklearn.preprocessing.data.OneHotEncoder",class{}),this.registerType("sklearn.preprocessing.data.PolynomialFeatures",class{}),this.registerType("sklearn.preprocessing.data.PowerTransformer",class{}),this.registerType("sklearn.preprocessing.data.RobustScaler",class{}),this.registerType("sklearn.preprocessing.data.QuantileTransformer",class{}),this.registerType("sklearn.preprocessing.data.StandardScaler",class{}),this.registerType("sklearn.preprocessing.imputation.Imputer",class{}),this.registerType("sklearn.preprocessing.label.LabelBinarizer",class{}),this.registerType("sklearn.preprocessing.label.LabelEncoder",class{}),this.registerType("sklearn.preprocessing.label.MultiLabelBinarizer",class{}),this.registerType("sklearn.random_projection.GaussianRandomProjection",class{}),this.registerType("sklearn.svm._classes.LinearSVC",class{}),this.registerType("sklearn.svm._classes.NuSVC",class{}),this.registerType("sklearn.svm._classes.OneClassSVM",class{}),this.registerType("sklearn.svm._classes.SVC",class{}),this.registerType("sklearn.svm._classes.SVR",class{}),this.registerType("sklearn.svm.classes.LinearSVC",class{}),this.registerType("sklearn.svm.classes.OneClassSVM",class{}),this.registerType("sklearn.svm.classes.SVC",class{}),this.registerType("sklearn.svm.classes.SVR",class{}),this.registerType("sklearn.tree._classes.DecisionTreeClassifier",class{}),this.registerType("sklearn.tree._classes.DecisionTreeRegressor",class{}),this.registerType("sklearn.tree._classes.ExtraTreeClassifier",class{}),this.registerType("sklearn.tree._classes.ExtraTreeRegressor",class{}),this.registerType("sklearn.tree._tree.Tree",class{constructor(e,t,s){this.n_features=e,this.n_classes=t,this.n_outputs=s}__setstate__(e){this.max_depth=e.get("max_depth"),this.node_count=e.get("node_count"),this.nodes=e.get("nodes"),this.values=e.get("values")}}),this.registerType("sklearn.tree.tree.DecisionTreeClassifier",class{}),this.registerType("sklearn.tree.tree.DecisionTreeRegressor",class{}),this.registerType("sklearn.tree.tree.ExtraTreeClassifier",class{}),this.registerType("sklearn.utils._bunch.Bunch",class{}),this.registerType("sklearn.utils._metadata_requests.MetadataRequest",class{}),this.registerType("sklearn.utils._metadata_requests.MethodMetadataRequest",class{}),this.registerType("sklearn.utils.deprecation.DeprecationDict",class{}),this.registerType("pickle.Unpickler",class{constructor(e){this._reader=e instanceof Uint8Array?new l.BinaryReader(e):new l.StreamReader(e),this.persistent_load=()=>{throw new l.Error("Unsupported persistent id.")}}load(){let e=this._reader,t=[],s=[],i={},n=0;for(;e.position<e.length;){let a=e.byte();switch(a){case 128:{let o=e.byte();if(o>5)throw new l.Error(`Unsupported protocol version '${o}'.`);break}case 99:{let o=e.line(),c=e.line();s.push(this.find_class(o,c));break}case 147:{let o=s.pop(),c=s.pop();s.push(this.find_class(c,o));break}case 111:{let o=s,c=o.pop();s=t.pop();let u=this._instantiate(c,o);s.push(u);break}case 112:{let o=parseInt(e.line(),10);if(s.length===0)throw new l.Error("Empty stack during 'PUT' operation.");i[o]=s[s.length-1],n++;break}case 103:{let o=parseInt(e.line(),10);s.push(i[o]);break}case 48:s.pop();break;case 49:s=t.pop();break;case 50:if(s.length===0)throw new l.Error("Empty stack during 'DUP' operation.");s.push(s[s.length-1]);break;case 80:s.push(this.persistent_load(e.line()));break;case 81:s.push(this.persistent_load(s.pop()));break;case 82:{let o=s.pop(),c=s.pop();s.push(this._reduce(c,o));break}case 129:{let o=s.pop(),c=s.pop(),u=this._newobj(c,o);s.push(u);break}case 146:{let o=s.pop(),c=s.pop(),u=s.pop();if(Object.entries(o).length>0)throw new l.Error("Unpickle 'NEWOBJ_EX' not implemented.");let d=this._newobj(u,c);s.push(d);break}case 104:s.push(i[e.byte()]);break;case 105:{let o=e.line(),c=e.line(),u=s,d=`${o}.${c}`;s=t.pop();let _=this._instantiate(d,u);s.push(_);break}case 106:s.push(i[e.uint32()]);break;case 113:if(s.length===0)throw new l.Error("Empty stack during 'BINPUT' operation.");i[e.byte()]=s[s.length-1],n++;break;case 114:if(s.length===0)throw new l.Error("Empty stack during 'LONG_BINPUT' operation.");i[e.uint32()]=s[s.length-1],n++;break;case 74:s.push(e.int32());break;case 75:s.push(e.byte());break;case 76:s.push(parseInt(e.line(),10));break;case 77:s.push(e.uint16());break;case 66:s.push(e.read(e.int32()));break;case 67:s.push(e.read(e.byte()));break;case 142:s.push(e.read(e.int64().toNumber()));break;case 70:s.push(parseFloat(e.line()));break;case 71:s.push(e.float64());break;case 73:{let o=e.line();o==="01"?s.push(!0):o==="00"?s.push(!1):s.push(parseInt(o,10));break}case 93:s.push(new T.list);break;case 41:s.push([]);break;case 143:s.push([]);break;case 144:{let o=s;s=t.pop();let c=s[s.length-1];for(let u=0;u<o.length;u++)c.push(o[u]);break}case 145:{let o=s;s=t.pop(),s.push(o);break}case 100:{let o=s;s=t.pop();let c=new T.dict;for(let u=0;u<o.length;u+=2)c.__setitem__(o[u],o[u+1]);s.push(c);break}case 108:{let o=s;s=t.pop(),s.push(o);break}case 116:{let o=s;s=t.pop(),s.push(o);break}case 133:{s.push([s.pop()]);break}case 134:{let o=s.pop(),c=s.pop();s.push([c,o]);break}case 135:{let o=s.pop(),c=s.pop(),u=s.pop();s.push([u,c,o]);break}case 115:{let o=s.pop(),c=s.pop(),u=s[s.length-1];u.__setitem__?u.__setitem__(c,o):u[c]=o;break}case 117:{let o=s;s=t.pop();let c=s[s.length-1];if(c.__setitem__)for(let u=0;u<o.length;u+=2)c.__setitem__(o[u],o[u+1]);else for(let u=0;u<o.length;u+=2)c[o[u]]=o[u+1];break}case 125:s.push(new T.dict);break;case 97:{let o=s.pop();s[s.length-1].push(o);break}case 101:{let o=s;s=t.pop(),s[s.length-1].push(...o);break}case 83:{let o=e.line();s.push(o.substring(1,o.length-1));break}case 84:s.push(e.string(e.uint32()));break;case 85:s.push(e.string(e.byte()));break;case 86:s.push(e.line());break;case 88:s.push(e.string(e.uint32(),"utf-8"));break;case 140:s.push(e.string(e.byte(),"utf-8"));break;case 98:{let o=s.pop(),c=s.pop();if(c.__setstate__)c.__setstate__.__call__?c.__setstate__.__call__([c,o]):c.__setstate__(o);else if(ArrayBuffer.isView(o)||Object(o)!==o)c.__state__=o;else if(c instanceof Map&&o instanceof Map)for(let[u,d]of o)c.set(u,d);else if(c instanceof Map)for(let u in o)c.set(u,o[u]);else if(o instanceof Map)for(let[u,d]of o)c[u]=d;else Object.assign(c,o);c.__read__&&(c=c.__read__(this)),s.push(c);break}case 40:t.push(s),s=[];break;case 136:s.push(!0);break;case 137:s.push(!1);break;case 138:{let o=e.read(e.byte()),c=0;switch(o.length){case 0:c=0;break;case 1:[c]=o;break;case 2:c=o[1]<<8|o[0];break;case 3:c=o[2]<<16|o[1]<<8|o[0];break;case 4:c=o[3]<<24|o[2]<<16|o[1]<<8|o[0];break;case 5:c=o[4]*4294967296+((o[3]<<24|o[2]<<16|o[1]<<8|o[0])>>>0);break;default:c=Array.prototype.slice.call(o,0);break}s.push(c);break}case 139:s.push(e.read(e.uint32()));break;case 148:i[n++]=s[s.length-1];break;case 149:e.read(8);break;case 150:{s.push(e.read(e.int64().toNumber()));break}case 78:s.push(null);break;case 46:return s.pop();case 141:case 151:case 152:default:throw new l.Error(`Unknown opcode ${a} at position ${e.position-1}.`)}}throw new l.Error("Unexpected end of file.")}find_class(e,t){return b.__import__(e),b.resolve(`${e}.${t}`)}_instantiate(e,t){return b.invoke(e,t)}_newobj(e,t){return b.invoke(e,t)}_reduce(e,t){return b.invoke(e,t)}read(e){return this._reader.read(e)}stream(e){return this._reader.stream(e)}}),this.registerType("random.Random",class{}),this.registerType("re.Pattern",class{constructor(e,t){this.pattern=e,this.flags=t}}),this.registerType("spacy._ml.PrecomputableAffine",class{__setstate__(e){Object.assign(this,new D.Unpickler(e).load())}}),this.registerType("spacy.syntax._parser_model.ParserModel",class{__setstate__(e){Object.assign(this,new D.Unpickler(e).load())}}),this.registerType("theano.compile.function_module._constructor_Function",class{}),this.registerType("theano.compile.function_module._constructor_FunctionMaker",class{}),this.registerType("theano.compile.function_module.Function",class{}),this.registerType("theano.compile.function_module.Supervisor",class{}),this.registerType("theano.compile.io.In",class{}),this.registerType("theano.compile.io.SymbolicOutput",class{}),this.registerType("theano.compile.mode.Mode",class{}),this.registerType("theano.compile.ops.OutputGuard",class{}),this.registerType("theano.compile.ops.Shape",class{}),this.registerType("theano.compile.ops.Shape_i",class{}),this.registerType("theano.gof.destroyhandler.DestroyHandler",class{}),this.registerType("theano.gof.fg.FunctionGraph",class{}),this.registerType("theano.gof.graph.Apply",class{}),this.registerType("theano.gof.link.Container",class{}),this.registerType("theano.gof.opt._metadict",class{}),this.registerType("theano.gof.opt.ChangeTracker",class{}),this.registerType("theano.gof.opt.MergeFeature",class{}),this.registerType("theano.gof.optdb.Query",class{}),this.registerType("theano.gof.toolbox.PreserveVariableAttributes",class{}),this.registerType("theano.gof.toolbox.ReplaceValidate",class{}),this.registerType("theano.gof.utils.scratchpad",class{}),this.registerType("theano.misc.ordered_set.Link",class{}),this.registerType("theano.misc.ordered_set.OrderedSet",class{}),this.registerType("theano.sandbox.cuda.basic_ops.HostFromGpu",class{}),this.registerType("theano.sandbox.cuda.type.CudaNdarray_unpickler",class{}),this.registerType("theano.sandbox.cuda.type.CudaNdarrayType",class{}),this.registerType("theano.sandbox.cuda.var.CudaNdarraySharedVariable",class{}),this.registerType("theano.scalar.basic.Abs",class{}),this.registerType("theano.scalar.basic.Add",class{}),this.registerType("theano.scalar.basic.Cast",class{}),this.registerType("theano.scalar.basic.Composite",class{}),this.registerType("theano.scalar.basic.EQ",class{}),this.registerType("theano.scalar.basic.GE",class{}),this.registerType("theano.scalar.basic.Identity",class{}),this.registerType("theano.scalar.basic.IntDiv",class{}),this.registerType("theano.scalar.basic.Inv",class{}),this.registerType("theano.scalar.basic.LE",class{}),this.registerType("theano.scalar.basic.LT",class{}),this.registerType("theano.scalar.basic.Mul",class{}),this.registerType("theano.scalar.basic.Neg",class{}),this.registerType("theano.scalar.basic.Pow",class{}),this.registerType("theano.scalar.basic.Scalar",class{}),this.registerType("theano.scalar.basic.ScalarConstant",class{}),this.registerType("theano.scalar.basic.ScalarVariable",class{}),this.registerType("theano.scalar.basic.Second",class{}),this.registerType("theano.scalar.basic.Sgn",class{}),this.registerType("theano.scalar.basic.specific_out",class{}),this.registerType("theano.scalar.basic.Sub",class{}),this.registerType("theano.scalar.basic.Switch",class{}),this.registerType("theano.scalar.basic.Tanh",class{}),this.registerType("theano.scalar.basic.transfer_type",class{}),this.registerType("theano.scalar.basic.TrueDiv",class{}),this.registerType("theano.tensor.basic.Alloc",class{}),this.registerType("theano.tensor.basic.Dot",class{}),this.registerType("theano.tensor.basic.MaxAndArgmax",class{}),this.registerType("theano.tensor.basic.Reshape",class{}),this.registerType("theano.tensor.basic.ScalarFromTensor",class{}),this.registerType("theano.tensor.blas.Dot22",class{}),this.registerType("theano.tensor.blas.Dot22Scalar",class{}),this.registerType("theano.tensor.blas.Gemm",class{}),this.registerType("theano.tensor.elemwise.DimShuffle",class{}),this.registerType("theano.tensor.elemwise.Elemwise",class{}),this.registerType("theano.tensor.elemwise.Sum",class{}),this.registerType("theano.tensor.nnet.abstract_conv.AbstractConv2d",class{}),this.registerType("theano.tensor.nnet.abstract_conv.AbstractConv2d_gradInputs",class{}),this.registerType("theano.tensor.nnet.abstract_conv.AbstractConv2d_gradWeights",class{}),this.registerType("theano.tensor.nnet.corr.CorrMM",class{}),this.registerType("theano.tensor.nnet.corr.CorrMM_gradInputs",class{}),this.registerType("theano.tensor.nnet.corr.CorrMM_gradWeights",class{}),this.registerType("theano.tensor.nnet.nnet.CrossentropyCategorical1Hot",class{}),this.registerType("theano.tensor.nnet.nnet.CrossentropyCategorical1HotGrad",class{}),this.registerType("theano.tensor.nnet.nnet.CrossentropySoftmax1HotWithBiasDx",class{}),this.registerType("theano.tensor.nnet.nnet.CrossentropySoftmaxArgmax1HotWithBias",class{}),this.registerType("theano.tensor.nnet.nnet.Softmax",class{}),this.registerType("theano.tensor.nnet.nnet.SoftmaxGrad",class{}),this.registerType("theano.tensor.nnet.nnet.SoftmaxWithBias",class{}),this.registerType("theano.tensor.opt.MakeVector",class{}),this.registerType("theano.tensor.opt.ShapeFeature",class{}),this.registerType("theano.tensor.sharedvar.TensorSharedVariable",class{}),this.registerType("theano.tensor.signal.pool.MaxPoolGrad",class{}),this.registerType("theano.tensor.signal.pool.Pool",class{}),this.registerType("theano.tensor.subtensor.Subtensor",class{}),this.registerType("theano.tensor.type.TensorType",class{}),this.registerType("theano.tensor.var.TensorConstant",class{}),this.registerType("theano.tensor.var.TensorConstantSignature",class{}),this.registerType("theano.tensor.var.TensorVariable",class{}),this.registerType("thinc.describe.Biases",class{}),this.registerType("thinc.describe.Dimension",class{}),this.registerType("thinc.describe.Gradient",class{}),this.registerType("thinc.describe.Weights",class{}),this.registerType("thinc.describe.Synapses",class{}),this.registerType("thinc.neural._classes.affine.Affine",class{__setstate__(e){Object.assign(this,new D.Unpickler(e).load())}}),this.registerType("thinc.neural._classes.convolution.ExtractWindow",class{__setstate__(e){Object.assign(this,new D.Unpickler(e).load())}}),this.registerType("thinc.neural._classes.feature_extracter.FeatureExtracter",class{__setstate__(e){Object.assign(this,new D.Unpickler(e).load())}}),this.registerType("thinc.neural._classes.feed_forward.FeedForward",class{__setstate__(e){Object.assign(this,new D.Unpickler(e).load())}}),this.registerType("thinc.neural._classes.function_layer.FunctionLayer",class{__setstate__(e){Object.assign(this,new D.Unpickler(e).load())}}),this.registerType("thinc.neural._classes.hash_embed.HashEmbed",class{__setstate__(e){Object.assign(this,new D.Unpickler(e).load())}}),this.registerType("thinc.neural._classes.layernorm.LayerNorm",class{__setstate__(e){Object.assign(this,new D.Unpickler(e).load())}}),this.registerType("thinc.neural._classes.maxout.Maxout",class{__setstate__(e){Object.assign(this,new D.Unpickler(e).load())}}),this.registerType("thinc.neural._classes.resnet.Residual",class{__setstate__(e){Object.assign(this,new D.Unpickler(e).load())}}),this.registerType("thinc.neural._classes.softmax.Softmax",class{__setstate__(e){Object.assign(this,new D.Unpickler(e).load())}}),this.registerType("thinc.neural.mem.Memory",class{}),this.registerType("thinc.neural.ops.NumpyOps",class{}),this.registerType("__main__.BYOLState",class{constructor(e){Object.assign(this,e)}});let V=this.register("types");this.registerType("types.GenericAlias",class{}),this.registerType("types.SimpleNamespace",class{}),this.registerFunction("types.resolve_bases",e=>e),this.registerFunction("types.prepare_class",(e,t,s)=>{s?s=new T.dict(s):s=new T.dict;let i=null;s.__contains__("metaclass")?i=s.pop("metaclass"):t&&t.length>0?i=T.type(t[0]):i=T.type,i instanceof T.type&&(i=V._calculate_meta(i,t));let n=null;return T.hasattr(i,"__prepare__")||(n=new T.dict),[i,n,s]}),this.registerFunction("types._calculate_meta",e=>e),this.registerFunction("types.new_class",(e,t,s,i)=>{let n=V.resolve_bases(t),[a,o]=V.prepare_class(e,t,s);return i&&i(o),new a(e,n,o)}),V.ObjectType=T.object,V.ModuleType=T.module,V.MethodType=T.method,V.FunctionType=T.function,V.TypeType=T.type,V.CodeType=T.code,this.registerType("xgboost.compat.XGBoostLabelEncoder",class{}),this.registerType("xgboost.core.Booster",class{load_model(e){e instanceof Uint8Array}__setstate__(e){let t=e.get("handle");t&&(this.handle=t)}}),this.registerType("xgboost.sklearn.XGBClassifier",class{}),this.registerType("xgboost.sklearn.XGBRegressor",class{}),this.registerType("xgboost.sklearn.XGBRFClassifier",class{}),this.registerFunction("_codecs.encode",(e,t)=>b.invoke("builtins.bytearray",[e,t])),this.registerType("builtins.bytearray",class extends Uint8Array{constructor(e,t){if(e=T.bytes.__encode__(e,t),super(Number.isInteger(e)?e:e.length),Array.isArray(e))for(let s=0;s<e.length;s++)this[s]=e;else if(e instanceof Uint8Array)this.set(e,0);else if(typeof e=="string")for(let s=0;s<e.length;s++)this[s]=e.charCodeAt(s)}static __encode__(e,t){if(e===void 0)return 0;if(Number.isInteger(e)||Array.isArray(e)||e instanceof Uint8Array)return e;if(typeof e=="string")switch(t){case"latin1":case"latin-1":return e;case"utf8":case"utf-8":return new TextEncoder("utf-8").encode(e);case void 0:throw new l.Error("Unsupported string argument without an encoding.");default:throw new l.Error(`Unsupported encoding '${t}'.`)}throw new l.Error("Unsupported source.")}}),this.registerType("builtins.bytes",class extends Uint8Array{constructor(e,t){if(e=T.bytes.__encode__(e,t),super(Number.isInteger(e)?e:e.length),Array.isArray(e))for(let s=0;s<e.length;s++)this[s]=e;else if(e instanceof Uint8Array)this.set(e,0);else if(typeof e=="string")for(let s=0;s<e.length;s++)this[s]=e.charCodeAt(s)}static __encode__(e,t){if(e===void 0)return 0;if(Number.isInteger(e)||Array.isArray(e)||e instanceof Uint8Array)return e;if(typeof e=="string")switch(t){case"latin1":case"latin-1":return e;case"utf8":case"utf-8":return new TextEncoder("utf-8").encode(e);case void 0:throw new l.Error("Unsupported string argument without an encoding.");default:throw new l.Error(`Unsupported encoding '${t}'.`)}throw new l.Error("Unsupported source.")}}),this.registerType("builtins.memoryview",class{constructor(e){this._buf=e}get nbytes(){return this._buf.length}}),this.registerType("builtins.frozenset",class extends Set{constructor(e){if(super(),e)for(let t of e)this.add(t)}}),this.registerFunction("builtins.exec"),this.registerFunction("builtins.issubclass",(e,t)=>{let s=`${t.__module__}.${t.__name__}`;if(e.__module__&&e.__name__&&s===`${e.__module__}.${e.__name__}`)return!0;if(e.__bases__){for(let i of e.__bases__)if(T.issubclass(i,t))return!0}return!1}),this.registerFunction("builtins.isinstance",(e,t)=>e.__class__?T.issubclass(e.__class__,t):!1),this.registerFunction("builtins.hasattr",(e,t)=>e instanceof Map&&e.__contains__?e.__contains__(t):Object.prototype.hasOwnProperty.call(e,t)),this.registerFunction("builtins.getattr",(e,t,s)=>e&&e.__getattr__?e.__getattr__(t):Object.prototype.hasOwnProperty.call(e,t)?e[t]:s),this.registerFunction("builtins.setattr",(e,t,s)=>{e[t]=s}),this.registerType("builtins.set",class extends Set{__contains__(e){return this.has(e)}update(e){for(let t of e)this.add(t)}}),this.registerType("builtins.slice",class{constructor(e,t,s){this.start=e,this.stop=t,this.step=s}}),this.registerFunction("builtins.hash"),this.registerFunction("cloudpickle.cloudpickle._builtin_type",e=>e),this.registerFunction("cloudpickle.cloudpickle._fill_function"),this.registerType("cloudpickle.cloudpickle._empty_cell_value",class{}),this.registerFunction("cloudpickle.cloudpickle._make_cell",e=>{e=e||L.cloudpickle._empty_cell_value;let t=L.cloudpickle._make_empty_cell();return e!==L.cloudpickle._empty_cell_value&&(t.cell_contents=e),t}),this.registerFunction("cloudpickle.cloudpickle._make_function",(e,t,s,i,n)=>new V.FunctionType(e,t,s,i,n)),this.registerFunction("cloudpickle.cloudpickle._make_skel_func"),L.cloudpickle._DYNAMIC_CLASS_TRACKER_BY_ID=new T.dict,this.registerFunction("cloudpickle.cloudpickle._lookup_class_or_track",(e,t)=>(e&&(t=L.cloudpickle._DYNAMIC_CLASS_TRACKER_BY_ID.setdefault(e,t)),t)),this.registerFunction("cloudpickle.cloudpickle._make_skeleton_class",(e,t,s,i,n)=>{let a={metaclass:e},o=V.new_class(t,s,a,c=>c.update(i));return L.cloudpickle._lookup_class_or_track(n,o)}),this.registerFunction("cloudpickle.cloudpickle._make_empty_cell",()=>new T.cell),this.registerFunction("cloudpickle.cloudpickle._class_setstate",(e,t)=>{[t]=t;let s=null;for(let[i,n]of t.items())i==="_abc_impl"?s=n:T.setattr(e,i,n);if(se.version_info>=13&&t.__contains__("__firstlineno__")&&(e.__firstlineno__=t.get("__firstlineno__")),s)for(let i of s)e.register(i);return e}),this.registerFunction("cloudpickle.cloudpickle._function_setstate",(e,t)=>{let[,s]=t;[t]=t,s.pop("__globals__");let i=s.pop("__closure__");if(s.pop("_cloudpickle_submodules"),e.__globals__,i)for(let n=0;n<i.length;n++)try{}catch{}for(let[n,a]of s.items())T.setattr(e,n,a)}),this.registerFunction("cloudpickle.cloudpickle.subimport",e=>(b.__import__(e),se.modules.get(e))),this.registerFunction("cloudpickle.cloudpickle_fast._class_setstate"),this.registerFunction("cloudpickle.cloudpickle_fast._function_setstate");let ae=this.register("ray");this.register("ray.cloudpickle.cloudpickle"),ae.cloudpickle.cloudpickle._builtin_type=L.cloudpickle._builtin_type,this.registerType("collections.Counter",class{}),this.registerFunction("collections.defaultdict",()=>({})),this.registerFunction("copy.deepcopy"),this.registerFunction("copy_reg._reconstructor",(e,t,s)=>{if(t==="__builtin__.object"||t===T.object)return m.invoke(e,[]);if(t==="__builtin__.tuple"||t===T.tuple){let i=m.invoke(e,[]);for(let n=0;n<s.length;n++)i[n]=s[n];return i}throw new l.Error(`Unsupported copy_reg._reconstructor base type '${t}'.`)}),this.registerFunction("copy.deepcopy",()=>{throw new l.Error("Unsupported copy.deepcopy().")}),this.registerFunction("dill._dill._create_array",(e,t,s,i)=>{let n=e(...t);if(n.__setstate__&&n.__setstate__(s),i)throw new l.Error("'dill._dill._create_array::npdict' not implemented.");return n}),this.registerFunction("dill._dill._create_cell",()=>function(){}),this.registerFunction("dill._dill._create_code",e=>m.invoke("types.CodeType",[e])),this.registerFunction("dill._dill._create_function",()=>function(){}),this.registerFunction("dill._dill._create_namedtuple",(e,t,s)=>{let i=b.invoke("dill._dill._import_module",[`${s}.${e}`]);if(i)return i}),this.registerFunction("dill._dill._create_type",(e,...t)=>{let[s,i,n]=t,a=class extends i[0]{},o=n.__contains__("__module__")?`${n.__getitem__("__module__")}.${s}`:s;return m.registerType(o,Object.assign(a,n))}),this.registerFunction("dill._dill._eval_repr"),this.registerFunction("dill._dill._get_attr",(e,t)=>{if(Object.prototype.hasOwnProperty.call(e,t))return e[t]}),this.registerFunction("dill._dill._import_module",(e,t)=>{try{return e.startsWith("__runtime__.")?b.module(e):e.indexOf(".")===-1?b.__import__(e):b.resolve(e)}catch(s){if(t)return null;throw s}}),this.registerFunction("dill._dill._load_type",e=>{let t=m.register("dill._dill");if(!t._reverse_typemap){t._reverse_typemap=new Map;for(let s of["__builtin__","types"]){let i=m.register(s);for(let[n,a]of Object.entries(i))a.__module__==="builtins"&&a.__class__===T.type&&t._reverse_typemap.set(n,a)}t._reverse_typemap.set("PartialType",ie.partial),t._reverse_typemap.set("CellType",T.cell)}if(!t._reverse_typemap.has(e))throw new l.Error(`Unknown type name '${e}' in 'dill._dill._load_type'.`);return t._reverse_typemap.get(e)}),this.registerFunction("dill._dill.loads"),this.registerFunction("jax._src.array._reconstruct_array",(e,t,s,i)=>{let n=e(...t);n.__setstate__(s);let a=q.device_put(n);return a.aval=a.aval.update(i),a}),q._src.device_array.reconstruct_device_array=q._src.array._reconstruct_array,this.registerFunction("jax.device_put",e=>{let t=new q._src.core.ShapedArray(e.shape,e.dtype);return new q.Array(t,e.data)}),this.registerType("jax._src.core.AbstractValue",class{}),this.registerType("jax._src.core.UnshapedArray",class extends q._src.core.AbstractValue{}),this.registerType("jax._src.core.ShapedArray",class extends q._src.core.UnshapedArray{constructor(e,t,s){super(),this.shape=e,this.dtype=t,this.weak_type=s||!1}update(e){let t=e.get("shape")||this.shape,s=e.get("dtype")||this.dtype,i=e.get("weak_type")||this.weak_type;return new q._src.core.ShapedArray(t,s,i)}}),this.registerType("jax.Array",class{constructor(e,t){this.aval=e,this.data=t}get dtype(){return this.aval.dtype}get shape(){return this.aval.shape}tobytes(){return this.data}}),q.numpy.ndarray=q.Array,this.registerFunction("keras.saving.pickle_utils.deserialize_model_from_bytecode",()=>null),this.registerFunction("keras.src.saving.pickle_utils.deserialize_model_from_bytecode",ne.saving.pickle_utils.deserialize_model_from_bytecode),this.registerFunction("lasagne.nonlinearities.rectify"),this.registerFunction("lasagne.nonlinearities.softmax"),this.registerFunction("lasagne.objectives.categorical_crossentropy"),this.registerFunction("lasagne.updates.nesterov_momentum"),this.registerFunction("msgpack.unpackb",(e,t)=>{let s=class{constructor(i,n){this._buffer=i,this._position=0,this._view=new DataView(i.buffer,i.byteOffset,i.byteLength),this._ext_hook=n}value(){let i=this._view.getUint8(this.skip(1));if(i>=224)return i-256;if(i<192)return i<128?i:i<144?this.map(i-128):i<160?this.array(i-144):this.string(i-160);switch(i){case 192:return null;case 194:return!1;case 195:return!0;case 196:return this.read(this._view.getUint8(this.skip(1)));case 197:return this.read(this._view.getUint16(this.skip(2)));case 198:return this.read(this._view.getUint32(this.skip(4)));case 199:return this.extension(this._view.getUint8(this.skip(1)));case 200:return this.extension(this._view.getUint16(this.skip(2)));case 201:return this.extension(this._view.getUint32(this.skip(4)));case 202:return this._view.getFloat32(this.skip(4));case 203:return this._view.getFloat64(this.skip(8));case 204:return this._view.getUint8(this.skip(1));case 205:return this._view.getUint16(this.skip(2));case 206:return this._view.getUint32(this.skip(4));case 207:return this._view.getBitUint64(this.skip(8));case 208:return this._view.getInt8(this.skip(1));case 209:return this._view.getInt16(this.skip(2));case 210:return this._view.getInt32(this.skip(4));case 211:return this._view.getBigInt64(this.skip(8));case 212:return this.extension(1);case 213:return this.extension(2);case 214:return this.extension(4);case 215:return this.extension(8);case 216:return this.extension(16);case 217:return this.string(this._view.getUint8(this.skip(1)));case 218:return this.string(this._view.getUint16(this.skip(2)));case 219:return this.string(this._view.getUint32(this.skip(4)));case 220:return this.array(this._view.getUint16(this.skip(2)));case 221:return this.array(this._view.getUint32(this.skip(4)));case 222:return this.map(this._view.getUint16(this.skip(2)));case 223:return this.map(this._view.getUint32(this.skip(4)));default:throw new l.Error(`Invalid code '${i}'.`)}}map(i){let n={};for(let a=0;a<i;a++){let o=this.value(),c=this.value();n[o]=c}return n}array(i){let n=new Array(i);for(let a=0;a<i;a++)n[a]=this.value();return n}extension(i){let n=this._view.getUint8(this.skip(1)),a=this.read(i);return this._ext_hook(n,a)}skip(i){let n=this._position;if(this._position+=i,this._position>this._buffer.length)throw new l.Error(`Expected ${this._position-this._buffer.length} more bytes. The file might be corrupted. Unexpected end of file.`);return n}read(i){let n=this._buffer.subarray(this._position,this._position+i);return this._position+=i,n}string(i){let n=this.read(i);return this._decoder=this._decoder||new TextDecoder("utf8"),this._decoder.decode(n)}};return new s(e,t).value()}),this.registerFunction("nolearn.lasagne.base.objective"),this.registerFunction("numpy.core._DType_reconstruct"),this.registerFunction("numpy.core._ufunc_reconstruct"),this.registerFunction("numpy.core.multiarray._reconstruct",(e,t,s)=>z.ndarray.__new__(e,t,s)),this.registerFunction("numpy.core.multiarray.frombuffer",(e,t)=>{let s=[e.length/t.itemsize];return new z.ndarray(s,t,e)}),this.registerFunction("numpy._core.numeric._frombuffer",(e,t,s,i)=>z._core.multiarray.frombuffer(e,t).reshape(s,i)),this.registerFunction("numpy._core._internal._convert_to_stringdtype_kwargs",()=>new z.dtypes.StringDType),this.registerFunction("numpy.core.multiarray.scalar",(e,t)=>{let s=t;if(typeof t=="string"||t instanceof String){s=new Uint8Array(t.length);for(let i=0;i<t.length;i++)s[i]=t.charCodeAt(i)}switch(e.kind){case"b":{let i=new DataView(s.buffer,s.byteOffset,s.byteLength);switch(e.itemsize){case 1:return!!i.getInt8(0);default:throw new l.Error(`Unsupported scalar dtype boolean itemsize '${e.itemsize}'.`)}}case"f":{let i=new DataView(s.buffer,s.byteOffset,s.byteLength);switch(e.itemsize){case 2:return i.getFloat16(0,e.byteorder==="<");case 4:return i.getFloat32(0,e.byteorder==="<");case 8:return i.getFloat64(0,e.byteorder==="<");default:throw new l.Error(`Unsupported scalar dtype float itemsize '${e.itemsize}'.`)}}case"i":{let i=new DataView(s.buffer,s.byteOffset,s.byteLength);switch(e.itemsize){case 1:return i.getInt8(0);case 2:return i.getInt16(0,e.byteorder==="<");case 4:return i.getInt32(0,e.byteorder==="<");case 8:return i.getBigInt64(0,e.byteorder==="<");default:throw new l.Error(`Unsupported scalar dtype int itemsize '${e.itemsize}'.`)}}case"u":{let i=new DataView(s.buffer,s.byteOffset,s.byteLength);switch(e.itemsize){case 1:return i.getUint8(0);case 2:return i.getUint16(0,e.byteorder==="<");case 4:return i.getUint32(0,e.byteorder==="<");case 8:return i.getBigUint64(0,e.byteorder==="<");default:throw new l.Error(`Unsupported scalar dtype uint itemsize '${e.itemsize}'.`)}}case"U":{let i=new DataView(s.buffer,s.byteOffset,s.byteLength),n=[];for(let a=0;a<e.itemsize;a+=4)n.push(String.fromCodePoint(i.getUint32(a,!0)));return n.join("")}default:throw new l.Error(`Unsupported scalar dtype kind '${e.kind}'.`)}}),this.registerFunction("numpy.core._multiarray_umath.cbrt"),this.registerFunction("numpy.core._multiarray_umath.fmin"),this.registerFunction("numpy.core._multiarray_umath.fmax"),this.registerFunction("numpy.core._multiarray_umath.greater"),this.registerFunction("numpy.core._multiarray_umath.less"),this.registerFunction("numpy.core._multiarray_umath.log"),this.registerFunction("numpy.core._multiarray_umath.scalar",(e,t)=>{let s=t;if(typeof t=="string"){s=new Uint8Array(t.length);for(let n=0;n<t.length;n++)s[n]=t.charCodeAt(n)}let i=new DataView(s.buffer,s.byteOffset,s.byteLength);switch(e.__name__){case"uint8":return i.getUint8(0);case"float32":return i.getFloat32(0,!0);case"float64":return i.getFloat64(0,!0);case"int8":return i.getInt8(0,!0);case"int16":return i.getInt16(0,!0);case"int32":return i.getInt32(0,!0);case"int64":return i.getBigInt64(0,!0);default:throw new l.Error(`Unsupported scalar type '${e.__name__}'.`)}}),this.registerFunction("numpy.core._multiarray_umath.sin"),this.registerFunction("numpy.core._multiarray_umath.sqrt"),this.register("numpy._core.multiarray",z.core.multiarray),this.register("numpy._core._multiarray_umath",z.core._multiarray_umath),this.register("numpy._core._multiarray_umath",z.core._multiarray_umath),this.register("numpy.core.numeric",z._core.numeric),z._core._multiarray_umath._reconstruct=z.core.multiarray._reconstruct,this.registerFunction("numpy.load",e=>{let t=[147,78,85,77,80,89];if(!e.read(6).every((g,y)=>g===t[y]))throw new l.Error("Invalid signature.");let s=e.read(2),[i,n]=s;if(i>3)throw new l.Error(`Invalid version '${[i,n].join(".")}'.`);let a=new Uint8Array([0,0,0,0]);a.set(e.read(i>=2?4:2),0);let o=a[3]<<24|a[2]<<16|a[1]<<8|a[0],c=e.read(o);if(c=new TextDecoder(i>=3?"utf-8":"ascii").decode(c),c=JSON.parse(c.replace(/\(/,"[").replace(/\)/,"]").replace("[,","[1,]").replace(",]","]").replace(/'/g,'"').replace(/:\s*False\s*,/,":false,").replace(/:\s*True\s*,/,":true,").replace(/,\s*\}/," }")),!c.descr||c.descr.length<2)throw new l.Error("Missing property 'descr'.");if(!c.shape)throw new l.Error("Missing property 'shape'.");let d=c.shape,_=m.invoke("numpy.dtype",[c.descr.substring(1)]);_.byteorder=c.descr.substring(0,1);let f=null;switch(_.byteorder){case"|":{if(f=e.read(),_.kind==="O")return b.invoke("pickle.Unpickler",[f]).load();break}case">":case"<":{if(c.descr.length!==3&&c.descr[1]!=="U"&&c.descr.substring(1)!=="c16")throw new l.Error(`Unsupported data type '${c.descr}'.`);let g=d.length===0?1:d.reduce((x,F)=>x*F,1),y=e.getbuffer().nbytes>16777216;f=e.read(_.itemsize*g,y);break}default:throw new l.Error(`Unsupported data type '${c.descr}'.`)}return c.fortran_order&&(f=null),m.invoke("numpy.ndarray",[d,_,f])}),this.registerFunction("numpy.save",(e,t)=>{let s=t.dtype.str;if(s[0]!=="<"&&s[0]!==">")throw new l.Error(`Unsupported byte order '${s}'.`);if(s.length!==3&&s.substring(1)!=="c16"||s[1]!=="f"&&s[1]!=="i"&&s[1]!=="u"&&s[1]!=="c"&&s.substring(1)!=="b1")throw new l.Error(`Unsupported data type '${s}'.`);let i="";switch(t.shape.length){case 0:i="()";break;case 1:i=`(${t.shape[0]},)`;break;default:i=`(${t.shape.map(c=>c.toString()).join(", ")})`;break}let a=`{ ${[`'descr': '${s}'`,"'fortran_order': False",`'shape': ${i}`].join(", ")} }`;a+=`${" ".repeat(64-(a.length+2+8+1&63))}
|
|
27
|
+
`;let o=new TextEncoder("ascii");e.write([147,78,85,77,80,89,1,0]),e.write([a.length&255,a.length>>8&255]),e.write(o.encode(a)),e.write(t.tobytes())}),this.registerFunction("numpy.amin"),this.registerFunction("numpy.amax"),this.registerFunction("numpy.std"),this.registerFunction("numpy.asarray",(e,t)=>{let s=(c,u,d)=>{let _=c.shape[d],f=c.littleendian;if(d===c.shape.length-1)for(let g=0;g<_;g++){switch(c.dtype){case"f2":c.view.setFloat16(c.position,u[g],f);break;case"f4":c.view.setFloat32(c.position,u[g],f);break;case"f8":c.view.setFloat64(c.position,u[g],f);break;case"i1":c.view.setInt8(c.position,u[g],f);break;case"i2":c.view.setInt16(c.position,u[g],f);break;case"i4":c.view.setInt32(c.position,u[g],f);break;case"i8":c.view.setBigInt64(c.position,u[g],f);break;case"u1":c.view.setUint8(c.position,u[g],f);break;case"u2":c.view.setUint16(c.position,u[g],f);break;case"u4":c.view.setUint32(c.position,u[g],f);break;case"u8":c.view.setBigUint64(c.position,u[g],f);break;case"c8":c.view.setComplex64(c.position,u[g],f);break;case"c16":c.view.setComplex128(c.position,u[g],f);break;case"b1":c.view.setInt8(c.position,u[g]?1:0);break;default:throw new l.Error(`Unsupported tensor data type '${c.dtype}'.`)}c.position+=c.itemsize}else for(let g=0;g<_;g++)s(c,u[g],d+1)},i=c=>{if(c.every(u=>Array.isArray(u))){let u=c.map(_=>i(_)),[d]=u;for(let _=1;_<u.length;_++)if(d.length===u[_].length&&!u[_].every((f,g)=>f===d[g]))throw new l.Error("Invalid array shape.");return[c.length].concat(d)}return[c.length]},n=Array.isArray(e)?i(e):[],a=t.itemsize*n.reduce((c,u)=>c*u,1),o={position:0,itemsize:t.itemsize,dtype:t.str.substring(1),littleendian:t.str[0],shape:n,data:new Uint8Array(a)};return o.view=new DataView(o.data.buffer,o.data.byteOffset,a),s(o,e,0),m.invoke("numpy.ndarray",[n,t,o.data])}),this.registerFunction("numpy.max"),this.registerFunction("numpy.mean"),this.registerFunction("numpy.min"),this.registerFunction("numpy.ma.core._mareconstruct",(e,t,s,i)=>{let n=m.invoke(t,[s,i]),a=m.invoke("numpy.ndarray",[s,""]);return m.invoke(e,[n,a,i])}),this.registerFunction("numpy.random.__RandomState_ctor",()=>({})),this.registerFunction("numpy.random._pickle.__randomstate_ctor",()=>({})),this.registerType("numpy.random.bit_generator.BitGenerator",class{}),this.registerType("numpy.random.bit_generator.SeedSequence",class{}),this.registerFunction("numpy.random.bit_generator.__pyx_unpickle_SeedSequence"),this.registerType("numpy.random._mt19937.MT19937",class extends z.random.bit_generator.BitGenerator{}),this.registerType("numpy.random._pcg64.PCG64",class extends z.random.bit_generator.BitGenerator{}),this.registerType("numpy.random._pcg64.PCG64DXSM",class extends z.random.bit_generator.BitGenerator{}),this.registerType("numpy.random._philox.Philox",class extends z.random.bit_generator.BitGenerator{}),this.registerType("numpy.random._sfc64.SFC64",class extends z.random.bit_generator.BitGenerator{}),z.random._pickle.BitGenerators={MT19937:z.random._mt19937.MT19937,PCG64:z.random._pcg64.PCG64,PCG64DXSM:z.random._pcg64.PCG64DXSM,Philox:z.random._philox.Philox,SFC64:z.random._sfc64.SFC64},this.registerType("numpy.random._generator.Generator",class{constructor(e){this.bit_generator=e}}),this.registerFunction("numpy.random._pickle.__bit_generator_ctor",e=>{e=e||"MT19937";let t=z.random._pickle.BitGenerators[e];if(t)return new t;throw new l.Error(`Unknown bit generator '${e}'.`)}),this.registerFunction("numpy.random._pickle.__generator_ctor",(e,t)=>(t=t||z.random._pickle.__bit_generator_ctor,new z.random._generator.Generator(t(e)))),this.registerFunction("numpy.reshape"),this.registerFunction("sklearn.feature_selection._univariate_selection.f_classif"),this.registerFunction("sklearn.feature_selection._univariate_selection.f_regression"),this.registerFunction("sklearn.metrics.scorer._passthrough_scorer"),this.registerFunction("sklearn.metrics._classification.accuracy_score"),this.registerFunction("sklearn.metrics._classification.balanced_accuracy_score"),this.registerFunction("sklearn.metrics._classification.f1_score"),this.registerFunction("sklearn.metrics._classification.log_loss"),this.registerFunction("sklearn.metrics._classification.precision_score"),this.registerFunction("sklearn.metrics._classification.recall_score"),this.registerFunction("sklearn.metrics._dist_metrics.newObj",e=>e.__new__(e)),this.registerFunction("sklearn.metrics._ranking.roc_auc_score"),this.registerFunction("sklearn.metrics._regression.mean_absolute_error"),this.registerFunction("sklearn.metrics._regression.mean_absolute_percentage_error"),this.registerFunction("sklearn.metrics._regression.mean_squared_error"),this.registerFunction("sklearn.metrics._regression.r2_score"),U.metrics.regression=U.metrics._regression,U.metrics.r2_score=U.metrics._regression.r2_score,this.registerFunction("sklearn.metrics._regression.root_mean_squared_error"),this.registerFunction("sklearn.metrics._scorer._passthrough_scorer"),this.registerFunction("re._compile",(e,t)=>m.invoke("re.Pattern",[e,t])),this.registerFunction("srsly.cloudpickle.cloudpickle._builtin_type",(...e)=>function(){return m.invoke(`types.${e[0]}`,e)}),this.registerFunction("theano.scalar.basic.same_out"),this.registerFunction("theano.scalar.basic.same_out_nocomplex"),this.registerFunction("theano.scalar.basic.upcast_out"),this.registerFunction("theano.scalar.basic.upgrade_to_float"),this.registerFunction("theano.tensor.nnet.conv2d"),this.registerFunction("theano.tensor.type.values_eq_approx_remove_inf_nan"),this.registerFunction("theano.tensor.type.values_eq_approx_remove_nan"),this.registerType("torch.nn.modules.module.Module",class{constructor(){this._modules=b.invoke("collections.OrderedDict",[]),this._parameters=b.invoke("collections.OrderedDict",[]),this._buffers=b.invoke("collections.OrderedDict",[])}__setattr__(e,t){t instanceof r.nn.modules.module.Module?this._modules.set(e,t):this[e]=t}__getattr__(e){return this._modules.has(e)?this._modules.get(e):this[e]}__delattr__(e){this._modules.has(e)&&this._modules.delete(e)}children(){return this._modules.values()}named_modules(e,t,s){e=e||new Set,t=t||"";let i=new T.dict;if(!e.has(this)){s&&e.add(this),i.set(t,this);for(let[n,a]of this._modules.items())if(a&&a.named_modules){let o=`${t}${t?".":""}${n}`;for(let[c,u]of a.named_modules(e,o,s))i.set(c,u)}}return i}named_children(){return this._modules}parameters(){return this._parameters.values()}named_parameters(e){if(e)throw new l.Error("Named parameters with recurse not implemented.");return this._parameters}buffers(){return this._buffers.values()}named_buffers(e){if(e)throw new l.Error("Named parameters with recurse not implemented.");return this._buffers}_get_name(){return this.__class__.__name__}}),r.nn.Module=r.nn.modules.module.Module,r.nn.modules.Module=r.nn.modules.module.Module,this.registerType("torch._C._TensorBase",class extends T.object{}),this.registerType("torch._C._TensorMeta",class extends T.type{}),this.registerType("torch._C._VariableFunctionsClass",class extends T.object{}),this.registerType("torch._C.OperatorRegistry",class{constructor(){this.to_register=[],this.operators=new Map}registerPendingOperators(){for(let e of this.to_register){let t=e.schema().name;this.operators.has(t)||this.operators.set(t,[]),this.operators.get(t).push(e)}this.to_register=[]}registerOperator(e){this.to_register.push(e)}getOperators(e){return this.registerPendingOperators(),this.operators.has(e)?this.operators.get(e):[]}}),this.registerFunction("torch._C.getAllOperatorsFor",e=>r._C.getRegistry().getOperators(e)),this.registerType("torch._C.Operator",class{constructor(e){this._schema=e}schema(){return this._schema}getOperation(){return null}aliasAnalysisKind(){let e=this.schema(),t=e.aliasAnalysis();return r._C.TORCH_CHECK(t==="FROM_SCHEMA"||!e.hasAnyAliasInfo()),t}}),this.registerFunction("torch._C.getRegistry",()=>(r._C.r=r._C.r||new r._C.OperatorRegistry,r._C.r)),this.registerFunction("torch._C._get_schema",(e,t)=>{let s=r._C.getAllOperatorsFor(e);for(let i of s)if(i.schema().overload_name===t)return i.schema();throw new l.Error(`Schema '${e}.${t}' not found.`)}),this.registerFunction("torch._C._jit_get_schemas_for_operator",e=>r._C.getAllOperatorsFor(e).map(t=>t.schema())),this.registerFunction("torch._C._jit_get_operation",e=>{let t=r._C.getAllOperatorsFor(e);if(t.length===0)return[null,null];let s=t.map(i=>i.schema().overload_name);return[{},s]}),this.registerFunction("torch._C._get_operation_overload",(e,t)=>{let s=r._C.getAllOperatorsFor(e);for(let i of s)if(i.schema().overload_name===t)return[{},{},null];return null}),this.registerType("torch._C.MatchedSchema",class{constructor(e,t,s,i){this.inputs=e,this.return_types=t,this.register_field_names=s,this.schema_name=i}}),this.registerType("torch._C.Self",class{}),this.registerFunction("torch._C.toValues",(e,t)=>t.map(s=>s.value(e))),this.registerType("torch._C.SimpleSelf",class extends r._C.Self{constructor(e){super(),this._classType=e}makeSugared(e){return e.setType(this._classType),new r._C.SimpleValue(e)}getClassType(){return this._classType}}),this.registerType("torch._C.Function",class{isGraphFunction(){return!1}name(){return this.qualname().name()}}),this.registerType("torch._C.BuiltinOpFunction",class extends r._C.Function{constructor(e,t){super(),this._name=e,this._schema=t}qualname(){return this._name}getSchema(){return this._schema}ensure_defined(){}}),this.registerType("torch._C.DeadCodeEliminator",class{constructor(...e){this._aliasDb=null,this._useAliasDb=!1,this._memo=new Map,this._marked=new Set,this._liveValues=new Set,this._deleteCallback=()=>{},e.length>0&&e[0]instanceof r.Graph?([this._graph,this._sideEffectPolicy]=e,this._useAliasDb=!0):[this._sideEffectPolicy]=e}run(e,t){this.eliminateDeadForkInputs(e,t),this.mark(e.return_node()),this.mark(e),this._deleteCallback(this._liveValues),this.sweep(e,t)}setDeleteCallback(e){this._deleteCallback=e}eliminateDeadForkInputs(e,t){for(let s of e.nodes()){if(t)for(let n of s.blocks())this.eliminateDeadForkInputs(n,t);if(s.kind()!=="prim::fork")continue;let i=s.g("Subgraph");for(let n=0;n<i.inputs().length;n++)i.inputs()[n].hasUses()||(i.eraseInput(n),s.removeInput(n))}}markReturnNode(e){if(this._marked.has(e))return!1;r._C.AT_ASSERT(e.owningBlock().return_node()===e);let t=e.owningBlock().owningNode();if(t===null||t.kind()==="prim::Reverse")return this.mark(e);if(t.kind()==="prim::Loop"||t.kind()==="c10::onnx::Loop"){let s=new r._C.LoopView(t);for(let i=0;i<s.carriedOutputs().length;i++){if(t.kind()==="onnx::Loop"){this._liveValues.add(s.bodyCarriedOutputs()[i]);continue}let n=s.bodyCarriedInputs()[i],a=s.bodyCarriedOutputs()[i],o=s.carriedOutputs()[i];(this._liveValues.has(o)||n.hasUses())&&this._liveValues.add(a)}this._liveValues.add(s.nextCond())}else{r._C.AT_ASSERT(t.outputs().length===e.inputs().length);for(let s=0;s<t.outputs().length;s++){let i=e.inputs()[s],n=t.outputs()[s];this._liveValues.has(n)||this._liveValues.add(i)}}return this._marked.add(e),!0}markLoop(e){r._C.TORCH_INTERNAL_ASSERT(e.kind()==="prim::Loop");let t=!1,s=!1;do t=this.mark(e.blocks()[0]),s=s||t;while(t);return s}mark(...e){if(e.length===1&&e[0]instanceof r.Block){let[t]=e,s=!1;for(let n of t.nodes())if(this._sideEffectPolicy==="DONT_DELETE_NODES_WITH_SIDE_EFFECTS"&&this.hasSideEffects(n)){let a=this.mark(n);s=s||a}let i=this.markReturnNode(t.return_node());s=s||i;for(let n of t.nodes()){if(n.kind()==="prim::Loop"){let o=this.markLoop(n);s=s||o}else for(let o of n.blocks()){let c=this.mark(o);s=s||c}let a=this.markIfLive(n);s=s||a}return s}if(e.length===1&&e[0]instanceof r.Node){let[t]=e;if(this._marked.has(t))return!1;this._marked.add(t);let s=t;for(;s&&s.owningBlock();)this.mark(s),s=s.owningBlock().owningNode();for(let i of t.inputs())this._liveValues.has(i)||this._liveValues.add(i);return!0}throw new l.Error("Not implemented.")}markIfLive(e){for(let t of e.outputs())if(this._liveValues.has(t))return this.mark(e);return this._useAliasDb&&this.getOrCreateAliasDb().writesToAlias(e,this._liveValues)?this.mark(e):!1}sweep(e,t){let s=Array.from(e.nodes()).reverse();for(let i of s){if(this.removeDeadBlockOutputs(i),this.removeDeadLoopOutputs(i),t)for(let n of i.blocks())this.sweep(n,!0);!this._marked.has(i)&&!i.hasUses()&&i.destroy()}}hasUntrackedMutation(e){if(!this._useAliasDb){if(e.kind()==="prim::SetAttr")return!0;let t=e.maybeSchema();return t&&t.is_mutable()}return this.getOrCreateAliasDb().writesToWildcard(e)}hasSideEffects(e){let t=this._memo.get(e);if(t)return t;let s=e.hasSideEffects()||e.blocks().some(i=>Array.from(i.nodes()).some(n=>this.hasSideEffects(n)))||this.hasUntrackedMutation(e);return this._memo.set(e,s),s}removeDeadBlockOutputs(e){if(!(e.kind()!=="prim::If"&&e.kind()!=="prim::GradOf"))for(let t=e.outputs().length;t>0;t--){let s=t-1;if(!e.outputs()[s].hasUses()){e.eraseOutput(s);for(let i of e.blocks())i.eraseOutput(s)}}}removeDeadLoopOutputs(){}getOrCreateAliasDb(){return this._aliasDb||(this._aliasDb=new r._C.AliasDb(this._graph)),this._aliasDb}}),this.registerFunction("torch._C.EliminateDeadCode",(...e)=>{if(e.length===1&&e[0]instanceof r.Graph){let[t]=e,s="DONT_DELETE_NODES_WITH_SIDE_EFFECTS";new r._C.DeadCodeEliminator(t,s).run(t.block(),!0)}else if(e.length>0&&e[0]instanceof r.Block){let[t]=e,s=!1,i="DONT_DELETE_NODES_WITH_SIDE_EFFECTS";new r._C.DeadCodeEliminator(i).run(t,s)}else throw new l.Error("Not implemented.")}),this.registerFunction("torch._C.removeTupleNodes",()=>{}),this.registerFunction("torch._C.LowerSimpleTuples",(...e)=>{if(e.length===1&&e[0]instanceof r.Graph){let[t]=e;r._C.LowerSimpleTuples(t.block()),r._C.EliminateDeadCode(t)}else if(e.length===1&&e[0]instanceof r.Block){let[t]=e;for(let s of t.nodes()){r._C.removeTupleNodes(s,!1);for(let i of s.blocks())r._C.LowerSimpleTuples(i)}}else throw new l.Error("Not implemented.")}),this.registerFunction("torch._C.attributesEqualCSE",(e,t)=>{if(r._C.AT_ASSERT(e!==null),r._C.AT_ASSERT(t!==null),e.hasAttributes()!==t.hasAttributes())return!1;if(!e.hasAttributes()&&!t.hasAttributes())return!0;let s=e.attributeNames(),i=t.attributeNames();if(s.sort(),i.sort(),s.length!==i.length&&!s.every((n,a)=>n!==i[a]))return!1;for(let n of s){if(e.kindOf(n)!==t.kindOf(n))return!1;let a=e.kindOf(n);switch(a){case"i":case"f":case"s":case"t":{if(e[a](n)!==t[a](n))return!1;break}case"ival":{if(e[a](n)!==t[a](n))return!1;break}default:throw new l.Error("Not implemented.")}}return!0}),this.registerFunction("torch._C.get_hash",(...e)=>{let t=0;for(let s of e)if(typeof s=="number")t+=s|0;else if(typeof s=="string")t+=s.length|0;else if(Array.isArray(s))for(let i of s)t+=r._C.get_hash(i);return t}),this.registerFunction("torch._C.HashNode",e=>{r._C.AT_ASSERT(e!==null);let t=0;if(e.kind()==="prim::Constant"){let s=e.output().type();s.isSubtypeOf(r.NumberType.get())&&e.kindOf("value")==="i"?t=e.i("value"):s.isSubtypeOf(r.NumberType.get())&&e.kindOf("value")==="f"?t=e.f("value"):s.isSubtypeOf(r.NumberType.get())&&e.kindOf("value")==="c"?t=e.c("value"):s.isSubtypeOf(r.BoolType.get())&&(t=e.i("value"))}return r._C.get_hash(e.kind(),e.outputs().map(s=>s.type().kind()),e.inputs().map(s=>s.unique()),t)}),this.registerFunction("torch._C.EqualNode",(e,t)=>{if(e===null&&t===null)return!0;if(e===null||t===null||e.kind()!==t.kind())return!1;let s=e.outputs(),i=t.outputs();if(s.length!==i.length)return!1;for(let o=0;o<s.length;o++){let c=s[o].type(),u=i[o].type();if(!c.equals(u))return!1}let n=e.inputs(),a=t.inputs();if(n.length!==a.length||!n.every((o,c)=>o===a[c])||!r._C.attributesEqualCSE(e,t)||e.blocks().length!==t.blocks().length)return!1;for(let o=0;o<e.blocks().length;o++)if(e.blocks()[o]!==t.blocks()[o])return!1;return!0}),this.registerType("torch._C.NodeSet",class{constructor(){this._nodes=new Map}insert(e){let t=r._C.HashNode(e);this._nodes.has(t)?this._nodes.get(t).push(e):this._nodes.set(t,[e])}get(e){let t=r._C.HashNode(e);if(this._nodes.has(t)){let s=this._nodes.get(t);for(let i of s)if(r._C.EqualNode(i,e))return i}return null}has(e){return this.get(e)!==null}}),this.registerFunction("torch._C.isinstance",(e,t)=>{let s=e.pop().type();for(let i of t)if(s.isSubtypeOf(i)){e.push(!0);return}e.push(!1)}),this.registerType("torch._C.Tuple",class{constructor(e){this._elements=e}static create(e){return new r._C.Tuple(e)}elements(){return this._elements}}),this.registerFunction("torch._C.tupleConstruct",(e,t)=>{switch(r._C.TORCH_CHECK(t<=e.length),t){case 0:{e.push(new r._C.IValue(r._C.Tuple.create([])));break}case 1:{let s=r._C.Tuple.create([e.pop()]);e.push(new r._C.IValue(s));break}case 2:{let s=r._C.Tuple.create([e[e.length-2],e[e.length-1]]);e.pop(),e.pop(),e.push(new r._C.IValue(s));break}case 3:throw new l.Error("Not implemented.");default:throw new l.Error("Not implemented.")}}),this.registerFunction("torch._C.runNodeIfInputsAreConstant",(e,t,s)=>{let i=[];for(let n of e.inputs()){let a=r._C.toIValue(n);if(a)i.push(a);else return null}switch(e.kind()){case"prim::ListUnpack":{if(i.back().toList().size()!==e.outputs().length)return null;r._C.listUnpack(i,e.outputs().length);break}case"prim::TupleConstruct":{let n=e.output().type().expect(r.TupleType);n.name()?r._C.namedTupleConstruct(i,n,e.inputs().length):r._C.tupleConstruct(i,e.inputs().length);break}case"prim::ListConstruct":{r._C.listConstruct(i,e.output().type().expect(r.ListType),e.inputs().length);break}case"prim::DictConstruct":{r._C.dictConstruct(i,e.output().type().expect(r.DictType),e.inputs().length);break}case"prim::CreateObject":{r._C.createObject(i,e.output().type().expect(r.ClassType),!0);break}case"prim::GetAttr":{let n=r._C.pop(i).toObject().getAttr(e.s("name"));r._C.push(i,n);break}case"prim::isinstance":{r._C.isinstance(i,e.tys("types"));break}default:{let n=e.maybeSchema();if(n&&n.is_vararg)return null;let[a,o]=e.kind().split("::");if(!r.ops[a])throw new l.Error(`Unknown constant module 'torch.ops.${a}'.`);let u=r.ops[a][o];if(!u)throw new l.Error(`Unknown constant function 'torch.ops.${a}.${o}'.`);let d=i.map(f=>f.value),_=u(...d);i=_===void 0?[]:[new r._C.IValue(_)];break}}for(let n of i){if(n.isTensor()){let a=n.toTensor();if(a.defined()&&a.requires_grad())return null}if(t&&n.isCustomClass())return null;if(n.isCustomClass()){if(n.toObject().is_weak_compilation_ref()||!s)continue;let a=e;if(s.mayContainAlias(a.inputs(),[a.outputs()]))continue;n.toObject().unsafe_make_weak_compilation_ref()}if(n.isObject()&&!n.toObject().is_weak_compilation_ref())return null}return i}),this.registerType("torch._C.ConstantPropagator",class{constructor(e,t,s){this._made_change=!1,this._graph=e,this._aliasing_types=t,this._ignore_custom_classes=s}static NoAliasDb(e){return new r._C.ConstantPropagator(e,!1,!1)}run(){return this.ConstantPropagation(this._graph.block()),this._made_change}propagateNode(e){let t=[],s=r._C.runNodeIfInputsAreConstant(e,this._ignore_custom_classes);if(s){t=s;let i=e.owningGraph(),n=new r._C.WithInsertPoint(e);for(let a=0;a<t.length;a++){let o=r._C.tryInsertConstant(i,t[a]);o&&(this._made_change=!0,t[a].isNone()&&o.setType(e.outputs()[a].type()),e.outputs()[a].replaceAllUsesWith(o))}n.dispose()}}removeLoopNode(e){for(let s=0;s<e.outputs().length;s++)e.outputs()[s].replaceAllUsesWith(e.inputs()[s+2]);this._made_change=!0,e.destroy()}loopWillNotRun(e){let[t,s]=e.inputs(),i=r._C.constant_as(t,"toInt",1);return!(r._C.constant_as(s,"toBool",!0)&&i>0)}inlineIfBody(e){let t=e.owningNode();for(let s of e.nodes())s.moveBefore(t);for(let s=0;s<t.outputs().length;s++)t.outputs()[s].replaceAllUsesWith(e.outputs()[s]);t.destroy()}inlineIf(e){let t=r._C.constant_as(e.input(),"toBool");r._C.AT_ASSERT(t!==null);let s=t?0:1;this.ConstantPropagation(e.blocks()[s]),this.inlineIfBody(e.blocks()[s]),this._made_change=!0}replaceAndRemoveIfOutput(e,t,s){e.outputs()[t].replaceAllUsesWith(s),e.eraseOutput(t),e.blocks()[0].eraseOutput(t),e.blocks()[1].eraseOutput(t)}removeExtraIfOutputs(e){r._C.TORCH_CHECK(e.kind()==="prim::If");let[t,s]=e.blocks(),i=e.owningGraph(),n=t.outputs().length,a=new r._C.WithInsertPoint(e);for(let o=0;o<t.outputs().length;){let c=t.outputs()[o],u=s.outputs()[o];if(t.outputs()[o]===s.outputs()[o]){this.replaceAndRemoveIfOutput(e,o,t.outputs()[o]);continue}let d=r._C.toIValue(c);if(d&&r._C.EqualNode(c.node(),u.node())){let _=i.insertConstant(d);this.replaceAndRemoveIfOutput(e,o,_);continue}o++}this._made_change=this._made_change||n!==t.outputs().length,a.dispose()}removeExtraLoopOutputs(e){let t=e.outputs().length,[s]=e.blocks(),i=2,n=1;for(let a=e.outputs().length;a>0;a--){let o=a-1;if(s.inputs()[n+o]===s.outputs()[n+o]){let c=e.inputs()[i+o];e.outputs().at(o).replaceAllUsesWith(c),s.inputs()[n+o].replaceAllUsesWith(c),e.eraseOutput(o),e.removeInput(i+o),s.eraseInput(n+o),s.eraseOutput(n+o)}}this._made_change=this._made_change||t!==e.outputs().length}noMutableValues(e){return e.every(t=>!r._C.AliasDb.isMutableType(t))}getOrCreateAliasDb(){return this._aliasDb||(this._aliasDb=new r._C.AliasDb(this._graph)),this._aliasDb}supportedNode(e){r._C.skip_list=r._C.skip_list||new Set(["prim::If","prim::Loop","prim::Closure","prim::Constant","prim::AutogradZero","prim::Uninitialized","prim::Guard","prim::profile","prim::profile_ivalue","prim::unchecked_unwrap_optional","prim::awaitable","aten::dequantize"]);let t=!1;return this._aliasing_types?t=!this.getOrCreateAliasDb().hasWriters(e):t=this.noMutableValues(e.inputs())&&this.noMutableValues(e.outputs()),t&&!e.kind().startsWith("onnx::")&&!r._C.skip_list.has(e.kind())&&!e.isNondeterministic()&&!e.hasSideEffects()&&e.blocks().length===0}ConstantPropagation(...e){if(e[0]instanceof r.Graph)throw new l.Error("Not implemented.");if(e[0]instanceof r.Block){let[t]=e;for(let s of t.nodes())this.ConstantPropagation(s)}else if(e[0]instanceof r.Node){let[t]=e,s=t.inputs().every(i=>i.node().kind()==="prim::Constant");t.kind()==="prim::If"?s?this.inlineIf(t):(this.ConstantPropagation(t.blocks()),this.removeExtraIfOutputs(t)):t.kind()==="prim::Loop"?this.loopWillNotRun(t)?this.removeLoopNode(t):(this.ConstantPropagation(t.blocks()),this.removeExtraLoopOutputs(t)):s&&this.supportedNode(t)?this.propagateNode(t):this.ConstantPropagation(t.blocks())}else if(e.length===1&&Array.isArray(e[0])&&e[0].every(t=>t instanceof r.Block)){let[t]=e;for(let s of t)this.ConstantPropagation(s)}else throw new l.Error("Not implemented.")}}),this.registerFunction("torch._C.ConstantPropagationImmutableTypes",e=>{let s=r._C.ConstantPropagator.NoAliasDb(e).run();return s&&r._C.EliminateDeadCode(e),s}),this.registerType("torch._C.MutableTypePtrHelper",class{constructor(e){this._mutable_type_cache=e}mapTypeToAliasTypeSet(e){if(this._mutable_type_cache){let t=this.mapTypeToBorrowedAliasTypeSet(e);if(t)return t}return this.mapTypeToAliasTypeSetImpl(e)}mapTypeToAliasTypeSetImpl(e){if(e instanceof r.ListType||e instanceof r.DictType||e instanceof r.ClassType||e instanceof r.TensorType)return[r._C.unshapedType(e)];if(e instanceof r.UnionType){let t=[];for(let s of e.expect(r.UnionType).containedTypes()){let i=this.mapTypeToAliasTypeSet(s);i&&t.push(...i)}return t.length===0?null:t}if(e instanceof r.OptionalType){let t=e.getElementType();return this.mapTypeToAliasTypeSet(t)}if(e instanceof r.AnyType)return[r._C.AliasTypeSet([e])];if(e instanceof r.FutureType){let t=this.mapTypeToAliasTypeSet(e.getElementType());return t?[r._C.AliasTypeSet([r.FutureType.create(r._C.toSingleType(t))])]:null}if(e instanceof r.AwaitType){let t=this.mapTypeToAliasTypeSet(e.getElementType());return t?[r._C.AliasTypeSet([r.AwaitType.create(r._C.toSingleType(t))])]:null}if(e instanceof r.TupleType){let t=[];for(let s of e.elements()){let i=this.mapTypeToAliasTypeSet(s);i&&t.push(...i)}return t.length===0?null:[[r.TupleType.create(t)]]}return null}}),this.registerFunction("torch._C.isMutableTypeImpl",(e,t)=>{if(e instanceof r.TensorType||e instanceof r.ListType||e instanceof r.ClassType||e instanceof r.DictType)return!0;let s=new r._C.MutableTypePtrHelper(t);return t?s.mapTypeToBorrowedAliasTypeSet(e)!==null:s.mapTypeToAliasTypeSet(e)!==null}),this.registerType("torch._C.AliasDb",class{constructor(){this._writeIndex=new Map}static isMutableType(...e){if(e[0]instanceof r.Type){let[t]=e;return r._C.isMutableTypeImpl(t,null)}if(e[0]instanceof r.Value){let[t]=e;return r._C.AliasDb.isMutableType(t.type())}throw new l.Error("Not implemented.")}writesToAlias(){return!1}writesToWildcard(e){if(!this._writeIndex.has(e))return!1;let t=this._writeIndex.get(e);for(let s of this._wildcardIndex){let[,i]=s;if(t.test(i.index))return!0}return!1}safeToChangeAliasingRelationship(e,t){return r._C.hasWriters(e)||r._C.hasWriters(t)?!1:!(r._C.escapesScope(e)&&r._C.escapesScope(t))}}),this.registerFunction("torch._C.hasWriters",()=>{}),this.registerFunction("torch._C.escapesScope",()=>{}),this.registerType("torch._C.DepthFirstGraphNodeIterator",class{constructor(e){this._current=e.block().nodes().front()}next(){return null}}),this.registerType("torch._C.ConcatCombiner",class{constructor(e){this._graph=e,this._aliasDb=new r._C.AliasDb(e),this._combinable_concats=[]}collectOptimizableConcats(){let e=new r._C.DepthFirstGraphNodeIterator(this._graph);for(let t=e.next();t!==null;t=e.next())t.kind()==="aten::cat"&&this.handleConcat(t)}combineConcats(){if(this._combinable_concats.length===0)return!1;let e=this.getListConstructInputs();for(let t of e){let[s,i]=t,n=this.createListConstruct(i),a=s.input(0).node();n.output().setType(a.output().type()),n.insertBefore(s),a.replaceAllUsesWith(n)}return!0}run(){this.collectOptimizableConcats();let e=this.combineConcats();return e&&r._C.EliminateDeadCode(this._graph),e}}),this.registerFunction("torch._C.CombineConcats",e=>new r._C.ConcatCombiner(e).run()),this.registerType("torch._C.PeepholeOptimizeImpl",class{constructor(e,t){this._graph=e,this._shape_peepholes=!t}run(){let e=this.optimizeBlock(this._graph.block());return e=e||r._C.CombineConcats(this._graph),e}optimizeBlock(e){let t=!1;for(let s of e.nodes()){for(let i of s.blocks())t=t||this.optimizeBlock(i);if(s.kind()!=="prim::Constant"){let i=new r._C.WithInsertPoint(s);for(let n of s.outputs())n.type()instanceof r.NoneType&&(n.replaceAllUsesWith(this._graph.insertConstant(new r._C.IValue)),t=!0);i.dispose()}if(s.kind()!=="prim::If")if(s.kind()==="aten::__is__"||s.kind()==="aten::__isnot__"){r._C.AT_ASSERT(s.inputs().length===2);for(let i of[0,1]){let n=s.inputs()[i].mustBeNone(),a=s.inputs().at(1-i).mustNotBeNone();if(n&&a){let o=new r._C.WithInsertPoint(s),c=s.owningGraph().insertConstant(s.kind()==="aten::__isnot__");s.output().replaceAllUsesWith(c),t=!0,o.dispose()}}}else{if(s.kind()==="prim::unchecked_unwrap_optional"||s.kind()==="aten::_unwrap_optional")throw new l.Error("Not implemented.");if(s.kind()==="prim::unchecked_cast"){let i=r._C.unshapedType(s.input().type()),n=r._C.unshapedType(s.output().type());i.isSubtypeOf(n)&&(s.output().replaceAllUsesWith(s.input()),t=!0)}else if((s.kind()==="aten::Int"||s.kind()==="aten::ceil")&&s.inputs().length===1&&s.input().type()instanceof r.IntType)s.output().replaceAllUsesWith(s.input()),t=!0;else if(s.kind()==="aten::ne"||s.kind()==="aten::eq"){if(s.inputs().length!==2||s.inputs()[0]!==s.inputs()[1])continue;let i=s.inputs()[0].type(),n=o=>{let c=o.kind();return new Set("BoolType","IntType","FloatType","NoneType").has(c)},a=!1;if(i instanceof r.ListType?a=n(i.getElementType()):i instanceof r.DictType?a=n(i.getKeyType())&&n(i.getValueType()):a=n(i),a){let o=new r._C.WithInsertPoint(s);s.output().replaceAllUsesWith(this._graph.insertConstant(s.kind()==="aten::eq")),t=!0,o.dispose()}}else s.kind()==="aten::mul"||s.kind()==="aten::floordiv"||s.kind()==="aten::div"||s.kind()==="aten::add"||s.kind()}}return t}}),this.registerFunction("torch._C.PeepholeOptimize",(e,t)=>{let i=new r._C.PeepholeOptimizeImpl(e,t).run();return i&&r._C.EliminateDeadCode(e.block()),i}),this.registerFunction("torch._C.TORCH_INTERNAL_ASSERT",e=>{if(!e)throw new l.Error("Assertion failed.")}),this.registerFunction("torch._C.TORCH_CHECK",e=>{if(!e)throw new l.Error("Assertion failed.")}),this.registerFunction("torch._C.AT_ASSERT",e=>{if(!e)throw new l.Error("Assertion failed.")}),this.registerFunction("torch._C.eraseListLiterals",e=>{let t=new r._C.DepthFirstGraphNodeIterator(e);for(let s=t.next();s!==null;){let i=s;if(s=t.next(),i.kind()==="prim::EmptyListLiteral"){i.hasUses()&&r._C.TORCH_INTERNAL_ASSERT(i.output().type().isSubtypeOf(r.ListType.ofTensors()));let n=e.createList(r.TensorType.get(),[]);n.insertBefore(i),i.replaceAllUsesWith(n)}i.destroy()}}),this.registerFunction("torch._C.ConstantPooling",(...e)=>{if(e.length===1&&e[0]instanceof r.Graph){let[t]=e,s=new r._C.AliasDb(t),i=new r._C.NodeSet;r._C.ConstantPooling(t.block(),i,s)}else if(e.length===3&&e[0]instanceof r.Block){let[t,s,i]=e;for(let n of t.nodes()){if(n.blocks().length>0){for(let o of n.blocks())r._C.ConstantPooling(o,s,i);continue}if(n.kind()!=="prim::Constant")continue;if(s.has(n)){let o=s.get(n),c=r._C.toIValue(o.output()),u=r._C.toIValue(n.output());if(!(c&&u&&c.is(u))&&!i.safeToChangeAliasingRelationship(n.outputs(),o.outputs()))continue;n.replaceAllUsesWith(o),n.destroy();continue}else s.insert(n);let[a]=n.owningGraph().block().nodes();n!==a&&n.moveBefore(a)}}else throw new l.Error("Not implemented.")}),this.registerFunction("torch._C.handleBlock",()=>{}),this.registerFunction("torch._C.autocastEnabled",()=>!0),this.registerFunction("torch._C.Autocast",e=>{r._C.autocastEnabled()&&r._C.handleBlock(e.block(),null)}),this.registerFunction("torch._C.preoptimizeGraph",(e,t)=>{t=t||!1,r._C.Inline(e),r._C.PeepholeOptimize(e,!0),r._C.ConstantPropagationImmutableTypes(e),t||r._C.Autocast(e),r._C.ConstantPooling(e)}),this.registerType("torch._C.GraphFunction",class extends r._C.Function{constructor(e,t,s,i){super(),this._name=e,this._graph=t,this._executor_execution_mode=i||null,this._function_creator=s,this._force_no_amp=!1}isGraphFunction(){return!0}qualname(){return this._name}graph(){return this._graph}optimized_graph(){let e=this._graph.copy();return r._C.preoptimizeGraph(e,this._force_no_amp),e}ensure_defined(){if(this._function_creator){let e=this._function_creator;this._function_creator=()=>{throw new l.Error("Recursive method call.")},e(this),this._function_creator=null}this.check_single_output()}check_single_output(){if(this.graph().outputs().length!==1)throw new l.Error("Graph must have a single output.")}getSchema(){return this._schema=this._schema||this.defaultSchemaFor(this),this._schema}setSchema(e){this._schema=e}num_inputs(){return this.graph().inputs().length}unshapedType(e){return e.isSubtypeOf(r.TensorType.get())?r.TensorType.get():e.containedTypes().length===0?e:e.withContained(e.containedTypes(s=>this.unshapedType(s)))}defaultSchemaFor(e){let t=[],s=[],i=e.graph(),n=e.num_inputs();for(let o=0;o<n;o++){let c=i.inputs()[o],u=c.hasDebugName()?c.debugNameBase():`argument_${o}`,d=new r.Argument(u,this.unshapedType(i.inputs()[o].type()));t.push(d)}let a=i.outputs().length;for(let o=0;o<a;o++){let c=new r.Argument("",this.unshapedType(i.outputs()[o].type()));s.push(c)}return new r.FunctionSchema(e.name(),"",t,s)}}),this.registerType("torch.ao.quantization.fake_quantize.FakeQuantize",class{}),this.registerType("torch.ao.quantization.fake_quantize.FusedMovingAvgObsFakeQuantize",class{}),this.registerType("torch.ao.quantization.observer._PartialWrapper",class{}),this.registerType("torch.ao.quantization.observer.HistogramObserver",class{}),this.registerType("torch.ao.quantization.observer.MovingAverageMinMaxObserver",class{}),this.registerType("torch.ao.quantization.observer.MovingAveragePerChannelMinMaxObserver",class{}),this.registerType("torch.ao.quantization.observer.MinMaxObserver",class{}),this.registerType("torch.ao.quantization.observer.PerChannelMinMaxObserver",class{}),this.registerType("torch.ao.quantization.observer.PlaceholderObserver",class{}),this.registerType("torch.ao.quantization.qconfig.QConfig",class{}),this.registerType("torch.ao.quantization.qconfig.QConfigDynamic",class{}),this.registerType("torch.ao.quantization.stubs.DeQuantStub",class{}),this.registerType("torch.ao.quantization.stubs.QuantStub",class{}),this.registerType("torch.ao.quantization.stubs.QuantWrapper",class{}),this.registerFunction("torch.ao.quantization.qconfig._activation_is_memoryless"),this.registerFunction("torch.ao.quantization.qconfig._add_module_to_qconfig_obs_ctr"),this.registerFunction("torch.ao.quantization.fx.graph_module._save_packed_weight"),this.registerFunction("torch.ao.quantization.fx._lower_to_native_backend._load_packed_weight"),this.registerFunction("torch.ao.quantization.fx._lower_to_native_backend._save_packed_weight"),this.registerFunction("torch.ao.quantization.observer._is_activation_post_process"),this.registerFunction("torch.ao.quantization.quantize._observer_forward_hook"),this.registerFunction("torch.ao.quantization.quantization_mappings._get_special_act_post_process"),this.registerFunction("torch.ao.quantization.quantization_mappings.get_default_dynamic_quant_module_mappings"),this.registerFunction("torch.ao.quantization.quantization_mappings.get_default_qat_module_mappings"),this.registerFunction("torch.ao.quantization.quantization_mappings.get_default_qconfig_propagation_list"),this.registerFunction("torch.ao.quantization.quantization_mappings.get_default_static_quant_module_mappings"),this.registerFunction("torch.ao.quantization.quantization_mappings.get_default_static_quant_reference_module_mappings"),this.registerFunction("torch.ao.quantization.quantization_mappings.no_observer_set"),this.registerFunction("torch.ao.quantization.quantization_mappings._has_special_act_post_process"),this.registerFunction("torch.ao.quantization.utils.get_qparam_dict"),this.registerFunction("torch.ao.quantization.utils.has_no_children_ignoring_parametrizations"),this.registerFunction("torch.amp.grad_scaler._refresh_per_optimizer_state"),this.registerType("torch._C._LegacyVariableBase",class{}),this.registerType("torch.autograd.variable.Variable",class extends r._C._LegacyVariableBase{}),this.registerType("torch.autograd.function._SingleLevelFunction",class{}),this.registerType("torch.autograd.function.Function",class extends r.autograd.function._SingleLevelFunction{}),this.registerType("torch.backends.cudnn.rnn.Unserializable",class{}),this.registerFunction("torch.distributed._shard.sharded_tensor.pre_load_state_dict_hook"),this.registerFunction("torch.distributed._shard.sharded_tensor.state_dict_hook"),this.registerFunction("torch.distributed._sharded_tensor.state_dict_hook"),this.registerFunction("torch.distributed._sharded_tensor.pre_load_state_dict_hook"),this.registerType("torch.distributed.algorithms.join._JoinConfig",class{}),this.registerType("torch.distributed.remote_device._remote_device",class{}),this.registerType("torch.distributed._shard.metadata.ShardMetadata",class{}),this.registerType("torch.distributed._shard.sharded_tensor.api.ShardedTensor",class{}),this.registerType("torch.distributed._shard.sharded_tensor.metadata.ShardedTensorMetadata",class{}),this.registerType("torch.distributed._shard.sharded_tensor.metadata.TensorProperties",class{}),this.registerType("torch.distributed._shard.sharded_tensor.shard.Shard",class{}),this.registerType("torch.distributed._tensor.api.DTensor",class extends r._C._TensorMeta{}),this.registerType("torch.distributed._tensor.placement_types.DTensorSpec",class{}),this.registerType("torch.distributed._tensor.placement_types.Shard",class{}),this.registerType("torch.distributed._tensor.placement_types.TensorMeta",class{}),this.registerType("torch.distributed.device_mesh.DeviceMesh",class{}),this.registerType("torch.distributions.bernoulli.Bernoulli",class{}),this.registerType("torch.distributions.beta.Beta",class{}),this.registerType("torch.distributions.binomial.Binomial",class{}),this.registerType("torch.distributions.categorical.Categorical",class{}),this.registerType("torch.distributions.constraints._GreaterThan",class{}),this.registerType("torch.distributions.constraints._Interval",class{}),this.registerType("torch.distributions.constraints._LowerCholesky",class{}),this.registerType("torch.distributions.constraints._Real",class{}),this.registerType("torch.distributions.dirichlet.Dirichlet",class{}),this.registerType("torch.distributions.mixture_same_family.MixtureSameFamily",class{}),this.registerType("torch.distributions.multivariate_normal.MultivariateNormal",class{}),this.registerType("torch.distributions.normal.Normal",class{}),this.registerType("torch.distributions.transforms._InverseTransform",class{}),this.registerType("torch.distributions.transforms.AffineTransform",class{}),this.registerType("torch.distributions.transforms.ComposeTransform",class{}),this.registerType("torch.distributions.transforms.ExpTransform",class{}),this.registerType("torch.distributions.transforms.LowerCholeskyTransform",class{}),this.registerType("torch.distributions.uniform.Uniform",class{}),this.registerType("torch.nn.backends.thnn._get_thnn_function_backend",class{}),this.registerType("torch.nn.intrinsic.modules.fused._FusedModule",class{}),this.registerType("torch.nn.intrinsic.modules.fused.ConvBnReLU2d",class{}),this.registerType("torch.nn.intrinsic.modules.fused.ConvReLU2d",class{}),this.registerType("torch.nn.intrinsic.modules.fused.BNReLU2d",class{}),this.registerType("torch.nn.intrinsic.qat.modules.conv_fused.ConvBn2d",class{}),this.registerType("torch.nn.intrinsic.qat.modules.conv_fused.ConvBnReLU2d",class{}),this.registerType("torch.nn.intrinsic.qat.modules.conv_fused.ConvReLU2d",class{}),this.registerType("torch.nn.intrinsic.quantized.modules.bn_relu.BNReLU2d",class{}),this.registerType("torch.nn.intrinsic.quantized.modules.conv_relu.ConvReLU1d",class{}),this.registerType("torch.nn.intrinsic.quantized.modules.conv_relu.ConvReLU2d",class{}),this.registerType("torch.nn.intrinsic.quantized.modules.linear_relu.LinearReLU",class{}),this.registerType("torch.nn.modules.activation.CELU",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.ELU",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.GELU",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.GLU",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.Hardtanh",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.Hardshrink",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.Hardsigmoid",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.Hardswish",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.LeakyReLU",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.LogSigmoid",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.LogSoftmax",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.Mish",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.MultiheadAttention",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.ReLU",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.ReLU6",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.PReLU",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.RReLU",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.SELU",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.Sigmoid",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.SiLU",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.Softmax",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.Softmax2d",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.Softmin",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.Softplus",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.Softshrink",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.Softsign",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.Tanh",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.Tanhshrink",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.activation.Threshold",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.adaptive.AdaptiveLogSoftmaxWithLoss",class{}),this.registerType("torch.nn.modules.batchnorm._NormBase",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.batchnorm._BatchNorm",class extends r.nn.modules.batchnorm._NormBase{}),this.registerType("torch.nn.modules.batchnorm.BatchNorm1d",class extends r.nn.modules.batchnorm._BatchNorm{}),this.registerType("torch.nn.modules.batchnorm.BatchNorm2d",class extends r.nn.modules.batchnorm._BatchNorm{}),this.registerType("torch.nn.modules.batchnorm.BatchNorm3d",class extends r.nn.modules.batchnorm._BatchNorm{}),this.registerType("torch.nn.modules.batchnorm.LazyBatchNorm1d",class{}),this.registerType("torch.nn.modules.batchnorm.LazyBatchNorm2d",class{}),this.registerType("torch.nn.modules.batchnorm.LazyBatchNorm3d",class{}),this.registerType("torch.nn.modules.batchnorm.SyncBatchNorm",class{}),this.registerType("torch.nn.modules.byted_batchnorm.BytedBatchNorm2d",class{}),this.registerType("torch.nn.modules.channelshuffle.ChannelShuffle",class{}),this.registerType("torch.nn.modules.container.ModuleDict",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.container.ModuleList",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.container.ParameterDict",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.container.ParameterList",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.container.Sequential",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.conv._ConvNd",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.conv.Conv1d",class extends r.nn.modules.conv._ConvNd{}),this.registerType("torch.nn.modules.conv.Conv2d",class extends r.nn.modules.conv._ConvNd{}),this.registerType("torch.nn.modules.conv.Conv3d",class extends r.nn.modules.conv._ConvNd{}),this.registerType("torch.nn.modules.conv._ConvTransposeNd",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.conv.ConvTranspose1d",class extends r.nn.modules.conv._ConvTransposeNd{}),this.registerType("torch.nn.modules.conv.ConvTranspose2d",class extends r.nn.modules.conv._ConvTransposeNd{}),this.registerType("torch.nn.modules.conv.ConvTranspose3d",class extends r.nn.modules.conv._ConvTransposeNd{}),this.registerType("torch.nn.modules.conv.LazyConv1d",class{}),this.registerType("torch.nn.modules.conv.LazyConv2d",class{}),this.registerType("torch.nn.modules.conv.LazyConv3d",class{}),this.registerType("torch.nn.modules.conv.LazyConvTranspose2d",class{}),this.registerType("torch.nn.modules.conv.LazyConvTranspose3d",class{}),this.registerType("torch.nn.modules.distance.CosineSimilarity",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.distance.PairwiseDistance",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.dropout._DropoutNd",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.dropout.AlphaDropout",class extends r.nn.modules.dropout._DropoutNd{}),this.registerType("torch.nn.modules.dropout.Dropout",class extends r.nn.modules.dropout._DropoutNd{}),this.registerType("torch.nn.modules.dropout.Dropout1d",class extends r.nn.modules.dropout._DropoutNd{}),this.registerType("torch.nn.modules.dropout.Dropout2d",class extends r.nn.modules.dropout._DropoutNd{}),this.registerType("torch.nn.modules.dropout.Dropout3d",class extends r.nn.modules.dropout._DropoutNd{}),this.registerType("torch.nn.modules.dropout.FeatureAlphaDropout",class extends r.nn.modules.dropout._DropoutNd{}),this.registerType("torch.nn.modules.fold.Fold",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.fold.Unfold",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.flatten.Flatten",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.flatten.Unflatten",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.instancenorm.InstanceNorm1d",class{}),this.registerType("torch.nn.modules.instancenorm.InstanceNorm2d",class{}),this.registerType("torch.nn.modules.instancenorm.InstanceNorm3d",class{}),this.registerType("torch.nn.modules.instancenorm.LazyInstanceNorm2d",class{}),this.registerType("torch.nn.modules.instancenorm.LazyInstanceNorm3d",class{}),this.registerType("torch.nn.modules.linear._LinearWithBias",class{}),this.registerType("torch.nn.modules.linear.Bilinear",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.linear.Identity",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.linear.LazyLinear",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.linear.Linear",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.linear.NonDynamicallyQuantizableLinear",class extends r.nn.modules.linear.Linear{}),this.registerType("torch.nn.modules.loss._Loss",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.loss._WeightedLoss",class extends r.nn.modules.loss._Loss{}),this.registerType("torch.nn.modules.loss.BCELoss",class extends r.nn.modules.loss._WeightedLoss{}),this.registerType("torch.nn.modules.loss.BCEWithLogitsLoss",class extends r.nn.modules.loss._Loss{}),this.registerType("torch.nn.modules.loss.CrossEntropyLoss",class extends r.nn.modules.loss._WeightedLoss{}),this.registerType("torch.nn.modules.loss.CosineEmbeddingLoss",class extends r.nn.modules.loss._Loss{}),this.registerType("torch.nn.modules.loss.CTCLoss",class extends r.nn.modules.loss._Loss{}),this.registerType("torch.nn.modules.loss.GaussianNLLLoss",class extends r.nn.modules.loss._Loss{}),this.registerType("torch.nn.modules.loss.HuberLoss",class extends r.nn.modules.loss._Loss{}),this.registerType("torch.nn.modules.loss.HingeEmbeddingLoss",class extends r.nn.modules.loss._Loss{}),this.registerType("torch.nn.modules.loss.KLDivLoss",class extends r.nn.modules.loss._Loss{}),this.registerType("torch.nn.modules.loss.L1Loss",class extends r.nn.modules.loss._Loss{}),this.registerType("torch.nn.modules.loss.MarginRankingLoss",class extends r.nn.modules.loss._Loss{}),this.registerType("torch.nn.modules.loss.MultiLabelMarginLoss",class extends r.nn.modules.loss._Loss{}),this.registerType("torch.nn.modules.loss.MultiLabelSoftMarginLoss",class extends r.nn.modules.loss._Loss{}),this.registerType("torch.nn.modules.loss.MultiMarginLoss",class extends r.nn.modules.loss._WeightedLoss{}),this.registerType("torch.nn.modules.loss.MSELoss",class extends r.nn.modules.loss._Loss{}),this.registerType("torch.nn.modules.loss.NLLLoss",class extends r.nn.modules.loss._WeightedLoss{}),this.registerType("torch.nn.modules.loss.NLLLoss2d",class extends r.nn.modules.loss.NLLLoss{}),this.registerType("torch.nn.modules.loss.PoissonNLLLoss",class{}),this.registerType("torch.nn.modules.loss.SmoothL1Loss",class{}),this.registerType("torch.nn.modules.loss.SoftMarginLoss",class{}),this.registerType("torch.nn.modules.loss.TripletMarginLoss",class{}),this.registerType("torch.nn.modules.loss.TripletMarginWithDistanceLoss",class{}),this.registerType("torch.nn.modules.module._IncompatibleKeys",class{}),this.registerType("torch.nn.modules.module._WrappedHook",class{}),this.registerType("torch.nn.modules.module.PatchForward",class{}),this.registerType("torch.nn.modules.normalization.CrossMapLRN2d",class{}),this.registerType("torch.nn.modules.normalization.GroupNorm",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.normalization.LayerNorm",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.normalization.LocalResponseNorm",class{}),this.registerType("torch.nn.modules.normalization.RMSNorm",class{}),this.registerType("torch.nn.modules.padding._ReflectionPadNd",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.padding.ReflectionPad1d",class extends r.nn.modules.padding._ReflectionPadNd{}),this.registerType("torch.nn.modules.padding.ReflectionPad2d",class extends r.nn.modules.padding._ReflectionPadNd{}),this.registerType("torch.nn.modules.padding.ReflectionPad3d",class extends r.nn.modules.padding._ReflectionPadNd{}),this.registerType("torch.nn.modules.padding._ReplicationPadNd",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.padding.ReplicationPad1d",class extends r.nn.modules.padding._ReplicationPadNd{}),this.registerType("torch.nn.modules.padding.ReplicationPad2d",class extends r.nn.modules.padding._ReplicationPadNd{}),this.registerType("torch.nn.modules.padding.ReplicationPad3d",class extends r.nn.modules.padding._ReplicationPadNd{}),this.registerType("torch.nn.modules.padding.ZeroPad1d",class{}),this.registerType("torch.nn.modules.padding.ZeroPad2d",class{}),this.registerType("torch.nn.modules.padding.ZeroPad3d",class{}),this.registerType("torch.nn.modules.padding.ConstantPad1d",class{}),this.registerType("torch.nn.modules.padding.ConstantPad2d",class{}),this.registerType("torch.nn.modules.padding.ConstantPad3d",class{}),this.registerType("torch.nn.modules.padding.CircularPad3d",class{}),this.registerType("torch.nn.modules.pixelshuffle.PixelShuffle",class{}),this.registerType("torch.nn.modules.pixelshuffle.PixelUnshuffle",class{}),this.registerType("torch.nn.modules.pooling._AdaptiveAvgPoolNd",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.pooling.AdaptiveAvgPool1d",class extends r.nn.modules.pooling._AdaptiveAvgPoolNd{}),this.registerType("torch.nn.modules.pooling.AdaptiveAvgPool2d",class extends r.nn.modules.pooling._AdaptiveAvgPoolNd{}),this.registerType("torch.nn.modules.pooling.AdaptiveAvgPool3d",class extends r.nn.modules.pooling._AdaptiveAvgPoolNd{}),this.registerType("torch.nn.modules.pooling.AdaptiveMaxPool1d",class{}),this.registerType("torch.nn.modules.pooling.AdaptiveMaxPool2d",class{}),this.registerType("torch.nn.modules.pooling.AdaptiveMaxPool3d",class{}),this.registerType("torch.nn.modules.pooling.AvgPool1d",class{}),this.registerType("torch.nn.modules.pooling.AvgPool2d",class{}),this.registerType("torch.nn.modules.pooling.AvgPool3d",class{}),this.registerType("torch.nn.modules.pooling.FractionalMaxPool2d",class{}),this.registerType("torch.nn.modules.pooling.FractionalMaxPool3d",class{}),this.registerType("torch.nn.modules.pooling.LPPool1d",class{}),this.registerType("torch.nn.modules.pooling.LPPool2d",class{}),this.registerType("torch.nn.modules.pooling.LPPool3d",class{}),this.registerType("torch.nn.modules.pooling._MaxPoolNd",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.pooling.MaxPool1d",class extends r.nn.modules.pooling._MaxPoolNd{}),this.registerType("torch.nn.modules.pooling.MaxPool2d",class extends r.nn.modules.pooling._MaxPoolNd{}),this.registerType("torch.nn.modules.pooling.MaxPool3d",class extends r.nn.modules.pooling._MaxPoolNd{}),this.registerType("torch.nn.modules.pooling._MaxUnpoolNd",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.pooling.MaxUnpool1d",class extends r.nn.modules.pooling._MaxUnpoolNd{}),this.registerType("torch.nn.modules.pooling.MaxUnpool2d",class extends r.nn.modules.pooling._MaxUnpoolNd{}),this.registerType("torch.nn.modules.pooling.MaxUnpool3d",class extends r.nn.modules.pooling._MaxUnpoolNd{}),this.registerType("torch.nn.modules.rnn.GRU",class{}),this.registerType("torch.nn.modules.rnn.GRUCell",class{}),this.registerType("torch.nn.modules.rnn.LSTM",class{}),this.registerType("torch.nn.modules.rnn.LSTMCell",class{}),this.registerType("torch.nn.modules.rnn.RNNBase",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.rnn.RNN",class extends r.nn.modules.rnn.RNNBase{}),this.registerType("torch.nn.modules.rnn.RNNCellBase",class extends r.nn.modules.module.Module{}),this.registerType("torch.nn.modules.rnn.RNNCell",class extends r.nn.modules.rnn.RNNCellBase{}),this.registerType("torch.nn.modules.sparse.Embedding",class{}),this.registerType("torch.nn.modules.sparse.EmbeddingBag",class{}),this.registerType("torch.nn.modules.transformer.Transformer",class{}),this.registerType("torch.nn.modules.transformer.TransformerDecoder",class{}),this.registerType("torch.nn.modules.transformer.TransformerDecoderLayer",class{}),this.registerType("torch.nn.modules.transformer.TransformerEncoder",class{}),this.registerType("torch.nn.modules.transformer.TransformerEncoderLayer",class{}),this.registerType("torch.nn.modules.upsampling.Upsample",class{}),this.registerType("torch.nn.modules.upsampling.UpsamplingBilinear2d",class{}),this.registerType("torch.nn.modules.upsampling.UpsamplingNearest2d",class{}),this.registerType("torch.nn.parallel.data_parallel.DataParallel",class{}),this.registerType("torch.nn.parallel.distributed._DDPUnevenInputsConfig",class{}),this.registerType("torch.nn.parallel.distributed.DistributedDataParallel",class{}),this.registerType("torch.nn.qat.modules.conv.Conv2d",class{}),this.registerType("torch.nn.qat.modules.linear.Linear",class{}),this.registerType("torch.nn.quantized.modules.activation.ReLU",class{}),this.registerType("torch.nn.quantized.modules.activation.LeakyReLU",class{}),this.registerType("torch.nn.quantized.modules.activation.Softmax",class{}),this.registerType("torch.nn.quantized.dynamic.modules.linear.Linear",class{}),this.registerType("torch.nn.quantized.dynamic.modules.rnn.GRU",class{}),this.registerType("torch.nn.quantized.dynamic.modules.rnn.LSTM",class{}),this.registerType("torch.nn.quantized.dynamic.modules.rnn.LSTMCell",class{}),this.registerType("torch.nn.quantized.dynamic.modules.rnn.PackedParameter",class{}),this.registerType("torch.nn.quantized.modules.activation.ReLU6",class{}),this.registerType("torch.nn.quantized.modules.batchnorm.BatchNorm2d",class{}),this.registerType("torch.nn.quantized.modules.conv.Conv1d",class{}),this.registerType("torch.nn.quantized.modules.conv.Conv2d",class{}),this.registerType("torch.nn.quantized.modules.conv.ConvTranspose2d",class{}),this.registerType("torch.nn.quantized.modules.DeQuantize",class{}),this.registerType("torch.nn.quantized.modules.dropout.Dropout",class{}),this.registerType("torch.nn.quantized.modules.embedding_ops.Embedding",class{}),this.registerType("torch.nn.quantized.modules.embedding_ops.EmbeddingPackedParams",class{}),this.registerType("torch.nn.quantized.modules.functional_modules.FloatFunctional",class{}),this.registerType("torch.nn.quantized.modules.functional_modules.QFunctional",class{}),this.registerType("torch.nn.quantized.modules.linear.Linear",class{}),this.registerType("torch.nn.quantized.modules.linear.LinearPackedParams",class{}),this.registerType("torch.nn.quantized.modules.normalization.InstanceNorm2d",class{}),this.registerType("torch.nn.quantized.modules.normalization.GroupNorm",class extends r.nn.modules.normalization.GroupNorm{}),this.registerType("torch.nn.quantized.modules.normalization.LayerNorm",class extends r.nn.modules.normalization.LayerNorm{}),this.registerType("torch.nn.quantized.modules.Quantize",class{}),this.registerType("torch.ao.nn.quantizable.modules.activation.MultiheadAttention",class extends r.nn.modules.activation.MultiheadAttention{}),this.registerType("torch.ao.nn.quantizable.modules.rnn._LSTMLayer",class{}),this.registerType("torch.ao.nn.quantizable.modules.rnn._LSTMSingleLayer",class{}),this.registerType("torch.ao.nn.quantizable.modules.rnn.LSTM",class{}),this.registerType("torch.ao.nn.quantizable.modules.rnn.LSTMCell",class{}),this.registerType("torch.ao.nn.quantized.modules.activation.ELU",class extends r.nn.modules.activation.ELU{}),this.registerType("torch.ao.nn.quantized.modules.activation.Hardswish",class extends r.nn.modules.activation.Hardswish{}),this.registerType("torch.ao.nn.quantized.modules.activation.MultiheadAttention",class extends r.ao.nn.quantizable.modules.activation.MultiheadAttention{}),this.registerType("torch.ao.nn.quantized.modules.activation.PReLU",class extends r.nn.modules.module.Module{}),this.registerType("torch.ao.nn.quantized.modules.activation.ReLU6",class extends r.nn.modules.activation.ReLU{}),this.registerType("torch.ao.nn.quantized.modules.activation.LeakyReLU",class extends r.nn.modules.activation.LeakyReLU{}),this.registerType("torch.ao.nn.quantized.modules.utils.WeightedQuantizedModule",class extends r.nn.modules.module.Module{}),this.registerType("torch.ao.nn.quantized.modules.batchnorm._BatchNorm",class extends r.nn.modules.batchnorm._BatchNorm{}),this.registerType("torch.ao.nn.quantized.modules.batchnorm.BatchNorm2d",class extends r.ao.nn.quantized.modules.batchnorm._BatchNorm{}),this.registerType("torch.ao.nn.quantized.modules.conv.Conv1d",class extends r.nn.modules.module.Module{}),this.registerType("torch.ao.nn.quantized.modules.conv.Conv2d",class extends r.nn.modules.module.Module{}),this.registerType("torch.ao.nn.quantized.modules.conv._ConvNd",class extends r.ao.nn.quantized.modules.utils.WeightedQuantizedModule{}),this.registerType("torch.ao.nn.quantized.modules.conv._ConvTransposeNd",class extends r.ao.nn.quantized.modules.conv._ConvNd{}),this.registerType("torch.ao.nn.quantized.modules.conv.ConvTranspose1d",class extends r.ao.nn.quantized.modules.conv._ConvTransposeNd{}),this.registerType("torch.ao.nn.quantized.modules.conv.ConvTranspose2d",class extends r.ao.nn.quantized.modules.conv._ConvTransposeNd{}),this.registerType("torch.ao.nn.quantized.modules.Quantize",class extends r.nn.modules.module.Module{}),this.registerType("torch.ao.nn.quantized.modules.DeQuantize",class extends r.nn.modules.module.Module{}),this.registerType("torch.ao.nn.quantized.modules.dropout.Dropout",class extends r.nn.modules.dropout.Dropout{}),this.registerType("torch.ao.nn.quantized.modules.embedding_ops.Embedding",class extends r.nn.modules.module.Module{}),this.registerType("torch.ao.nn.quantized.modules.embedding_ops.EmbeddingPackedParams",class extends r.nn.modules.module.Module{}),this.registerType("torch.ao.nn.quantized.modules.functional_modules.FloatFunctional",class extends r.nn.modules.module.Module{}),this.registerType("torch.ao.nn.quantized.modules.functional_modules.QFunctional",class extends r.nn.modules.module.Module{}),this.registerType("torch.ao.nn.quantized.modules.functional_modules.FXFloatFunctional",class extends r.nn.modules.module.Module{}),this.registerType("torch.ao.nn.quantized.modules.linear.Linear",class extends r.ao.nn.quantized.modules.utils.WeightedQuantizedModule{}),this.registerType("torch.ao.nn.quantized.modules.linear.LinearPackedParams",class extends r.nn.modules.module.Module{}),this.registerType("torch.ao.nn.quantized.modules.normalization.LayerNorm",class extends r.nn.modules.normalization.LayerNorm{}),this.registerType("torch.ao.nn.quantized.modules.normalization.InstanceNorm1d",class extends r.nn.modules.instancenorm.InstanceNorm1d{}),this.registerType("torch.ao.nn.quantized.modules.normalization.InstanceNorm2d",class extends r.nn.modules.instancenorm.InstanceNorm2d{}),this.registerType("torch.ao.nn.quantized.modules.normalization.InstanceNorm3d",class extends r.nn.modules.instancenorm.InstanceNorm3d{}),this.registerType("torch.ao.nn.quantized.modules.rnn.LSTM",class{}),this.registerType("torch.ao.nn.quantized.dynamic.modules.linear.Linear",class extends r.ao.nn.quantized.modules.linear.Linear{}),this.registerType("torch.ao.nn.quantized.dynamic.modules.rnn.PackedParameter",class extends r.nn.modules.module.Module{}),this.registerType("torch.ao.nn.quantized.dynamic.modules.rnn.RNNBase",class extends r.nn.modules.module.Module{}),this.registerType("torch.ao.nn.quantized.dynamic.modules.rnn.GRU",class extends r.ao.nn.quantized.dynamic.modules.rnn.RNNBase{}),this.registerType("torch.ao.nn.quantized.dynamic.modules.rnn.LSTM",class extends r.ao.nn.quantized.dynamic.modules.rnn.RNNBase{}),this.registerType("torch.ao.nn.quantized.reference.modules.conv.Conv1d",class{}),this.registerType("torch.ao.nn.quantized.reference.modules.conv.Conv2d",class{}),this.registerType("torch.ao.nn.quantized.reference.modules.linear.Linear",class{}),this.registerType("torch.ao.nn.qat.modules.conv.Conv2d",class{}),this.registerType("torch.ao.nn.qat.modules.linear.Linear",class{}),this.registerType("torch.ao.nn.intrinsic.quantized.modules.conv_relu.ConvReLU1d",class extends r.ao.nn.quantized.modules.conv.Conv1d{}),this.registerType("torch.ao.nn.intrinsic.quantized.modules.conv_relu.ConvReLU2d",class extends r.ao.nn.quantized.modules.conv.Conv2d{}),this.registerType("torch.ao.nn.intrinsic.quantized.modules.linear_relu.LinearReLU",class extends r.ao.nn.quantized.modules.linear.Linear{}),this.registerType("torch.ao.nn.intrinsic.quantized.modules.bn_relu.BNReLU2d",class extends r.ao.nn.quantized.modules.batchnorm.BatchNorm2d{}),this.registerType("torch.ao.nn.intrinsic.modules.fused._FusedModule",class extends r.nn.modules.container.Sequential{}),this.registerType("torch.ao.nn.intrinsic.modules.fused.ConvBn2d",class extends r.ao.nn.intrinsic.modules.fused._FusedModule{}),this.registerType("torch.ao.nn.intrinsic.modules.fused.ConvReLU1d",class extends r.ao.nn.intrinsic.modules.fused._FusedModule{}),this.registerType("torch.ao.nn.intrinsic.modules.fused.ConvReLU2d",class extends r.ao.nn.intrinsic.modules.fused._FusedModule{}),this.registerType("torch.ao.nn.intrinsic.modules.fused.LinearReLU",class extends r.ao.nn.intrinsic.modules.fused._FusedModule{}),this.registerType("torch.ao.nn.intrinsic.modules.fused.ConvBnReLU2d",class extends r.ao.nn.intrinsic.modules.fused._FusedModule{}),this.registerType("torch.ao.nn.intrinsic.qat.modules.conv_fused.ConvBnReLU2d",class{}),this.registerType("torch.nn.utils.prune.CustomFromMask",class{}),this.registerType("torch.nn.utils.prune.L1Unstructured",class{}),this.registerType("torch.nn.utils.prune.LnStructured",class{}),this.registerType("torch.nn.utils.prune.PruningContainer",class{}),this.registerType("torch.nn.utils.prune.RandomUnstructured",class{}),this.registerType("torch.nn.utils.spectral_norm.SpectralNorm",class{}),this.registerType("torch.nn.utils.spectral_norm.SpectralNormStateDictHook",class{}),this.registerType("torch.nn.utils.spectral_norm.SpectralNormLoadStateDictPreHook",class{}),this.registerType("torch.nn.utils.weight_norm.WeightNorm",class{}),this.registerFunction("torch.nn.utils.parametrize.type_before_parametrizations"),this.registerType("torch.nn.utils.parametrize.ParametrizationList",class extends r.nn.modules.container.ModuleList{}),this.registerType("torch.torch_version.TorchVersion",class extends String{}),this.registerType("torch.optim.optimizer.Optimizer",class{}),this.registerType("torch.optim.adam.Adam",class extends r.optim.optimizer.Optimizer{}),this.registerType("torch.optim.adamw.AdamW",class{}),this.registerType("torch.optim.adagrad.Adagrad",class{}),this.registerType("torch.optim.adadelta.Adadelta",class{}),this.registerType("torch.optim.lbfgs.LBFGS",class{}),this.registerType("torch.optim.lr_scheduler.CosineAnnealingLR",class{}),this.registerType("torch.optim.lr_scheduler.CosineAnnealingWarmRestarts",class{}),this.registerType("torch.optim.lr_scheduler.CyclicLR",class{}),this.registerType("torch.optim.lr_scheduler.ExponentialLR",class{}),this.registerType("torch.optim.lr_scheduler.LambdaLR",class{}),this.registerType("torch.optim.lr_scheduler.LinearLR",class{}),this.registerType("torch.optim.lr_scheduler.MultiStepLR",class{}),this.registerType("torch.optim.lr_scheduler.OneCycleLR",class{}),this.registerType("torch.optim.lr_scheduler.ReduceLROnPlateau",class{}),this.registerType("torch.optim.lr_scheduler.StepLR",class{}),this.registerType("torch.optim.optimizer._RequiredParameter",class{}),this.registerType("torch.optim.radam.RAdam",class extends r.optim.optimizer.Optimizer{}),this.registerType("torch.optim.rmsprop.RMSprop",class{}),this.registerType("torch.optim.sgd.SGD",class{}),this.registerType("torch.optim.sparse_adam.SparseAdam",class{}),this.registerType("torch.optim.swa_utils.SWALR",class{}),r.optim.RAdam=r.optim.radam.RAdam,this.registerType("torch.quantization.fake_quantize.FakeQuantize",class{}),this.registerFunction("torch.quantization.fx.graph_module._save_packed_weight"),this.registerType("torch.quantization.observer._PartialWrapper",class{}),this.registerType("torch.quantization.observer.HistogramObserver",class{}),this.registerType("torch.quantization.observer.MinMaxObserver",class{}),this.registerType("torch.quantization.observer.MovingAverageMinMaxObserver",class{}),this.registerType("torch.quantization.observer.MovingAveragePerChannelMinMaxObserver",class{}),this.registerFunction("torch.quantization.observer._with_args"),this.registerType("torch.quantization.qconfig.QConfig",class{}),this.registerType("torch.quantization.stubs.DeQuantStub",class{}),this.registerType("torch.quantization.stubs.QuantStub",class{}),this.registerType("torch.utils._pytree.LeafSpec",class{}),this.registerType("torch.utils._pytree.TreeSpec",class{}),this.registerFunction("torch.utils._pytree.tree_map"),this.registerFunction("torch.utils.checkpoint.checkpoint"),this.registerType("torch.utils.data.dataloader._MultiProcessingDataLoaderIter",class{}),this.registerType("torch.utils.data.dataloader.DataLoader",class{}),this.registerFunction("torch.utils.data._utils.collate.default_collate"),r.utils.data.dataloader.default_collate=r.utils.data._utils.collate.default_collate,this.registerType("torch.utils.data.dataset.Subset",class{}),this.registerType("torch.utils.data.dataset.ConcatDataset",class{}),this.registerType("torch.utils.data.dataset.TensorDataset",class{}),this.registerType("torch.utils.data.sampler.BatchSampler",class{}),this.registerType("torch.utils.data.sampler.RandomSampler",class{}),this.registerType("torch.utils.data.sampler.SequentialSampler",class{}),this.registerType("torch.utils.data.sampler.SubsetRandomSampler",class{}),r.nn.Sequential=r.nn.modules.container.Sequential,this.registerType("torch.fx.experimental.symbolic_shapes.ShapeEnv",class{create_symintnode(){return new r.SymInt}}),this.registerType("torch.fx.proxy.TracerBase",class{constructor(){this.traced_func_name="forward"}}),this.registerType("torch.fx._symbolic_trace.Tracer",class extends r.fx.proxy.TracerBase{trace(e){let t=null;e instanceof r.nn.Module?(this.root=e,t=T.getattr(new T.type(e),this.traced_func_name),this.root_module_name=e._get_name(),this.submodule_paths=new T.dict(e.named_modules())):(this.root=new r.nn.Module,t=e);let s=T.getattr(this,"__class__",null);if(this.graph=new r.fx.graph.Graph(null,s),T.hasattr(this,"__code__")){let i=t.__code__;this.graph._co_fields={co_name:i.co_name,co_filename:i.co_filename,co_firstlineno:i.co_firstlineno}}return this.graph}is_leaf_module(e){return(e.__module__.startsWith("torch.nn")||e.__module__.startsWith("torch.ao.nn"))&&!(e instanceof r.nn.Sequential)}}),this.registerType("torch.fx.experimental.proxy_tensor.PythonKeyTracer",class extends r.fx._symbolic_trace.Tracer{}),this.registerType("torch.fx.experimental.proxy_tensor._ModuleStackTracer",class extends r.fx.experimental.proxy_tensor.PythonKeyTracer{}),this.registerFunction("torch.fx._lazy_graph_module._make_graph_module",(...e)=>{let t=e.pop()||r.fx.graph_module.GraphModule;return new t(...e)}),this.registerFunction("torch.fx.graph_module._deserialize_graph_module",(e,t,s)=>{let i=t.get("_tracer_cls");i||(i=r.fx._symbolic_trace.Tracer);let n=t.get("_graphmodule_cls_name","GraphModule"),a=i,o=class extends a{is_leaf_module(){return!0}},c=new r.fx.graph_module._CodeOnlyModule(t),u=t.get("_tracer_extras",new T.dict),d=new o().trace(c,u);d._tracer_cls=i;let _=r.fx._lazy_graph_module._make_graph_module(c,d,n,s);for(let[f,g]of t.items())T.hasattr(_,f)||T.setattr(_,f,g);return _}),this.registerFunction("torch.fx.graph_module._forward_from_src",(e,t)=>{t=W({},t);let s=new l.Execution.Context(t,null);b.exec(e,s);let i=t.forward;return delete t.forward,i}),this.registerFunction("torch.fx.graph_module.reduce_graph_module",(e,t)=>{let s=null;e.has("_code")?s=e.get("_code"):e.has("code")?s=e.get("code"):s=e._code||e.code;let i=b.invoke("torch.fx.graph_module._forward_from_src",[t+s,{}]);return b.invoke("torch.fx.graph_module._deserialize_graph_module",[i,e])}),this.registerFunction("torch.fx.graph_module.reduce_package_graph_module",(e,t,s)=>{let i=e.import_module(s).forward;return b.invoke("torch.fx.graph_module._deserialize_graph_module",[i,t])}),this.registerType("torch.fx.graph.CodeGen",class{}),this.registerType("torch.fx.graph._Namespace",class{constructor(){this._obj_to_name=new Map,this._unassociated_names=new Set,this._used_names=new Set,this._base_count={}}create_name(e,t){if(t&&this._obj_to_name.has(t))return m._obj_to_name.get(t);e=e||"_unnamed",e=/^\d+$/.test(e)?`_${e}`:e,e=e.replace(/[^0-9a-zA-Z_]+/,"_");let s=e.match(/(.*)_(\d+)$"/),i=e,n=null;for(s&&([,i]=s,n=parseInt(s[2],10)),e=n?`${i}_${n}`:i,n||(n=this._base_count[i]||0);this._used_names.has(e)||this._is_illegal_name(e,t);)n+=1,e=`${i}_${n}`;return this._used_names.add(e),this._base_count[i]=n,t?this._obj_to_name[t]=e:this._unassociated_names.add(e),e}_is_illegal_name(){return!1}associate_name_with_obj(){}}),this.registerType("torch.fx.node.Node",class{constructor(e,t,s,i,n,a,o){this.graph=e,this.name=t,this.op=s,this.target=i,this._input_nodes=new T.dict,this.__update_args_kwargs(n,a),this.users=new T.dict,this.type=o,this._prev=this,this._next=this,this._erased=!1,this._repr_fn=null,this.meta=new T.dict}get args(){return this._args}get kwargs(){return this._kwargs}get next(){return this._next}prepend(e){e._remove_from_list();let t=this._prev;[t._next,e._prev]=[e,t],[e._next,this._prev]=[this,e]}_remove_from_list(){let[e,t]=[this._prev,this._next];[e._next,t._prev]=[t,e]}__update_args_kwargs(e,t){let s=n=>(n instanceof r.fx.node.Node&&(this._input_nodes.setdefault(n),n.users.setdefault(this)),n),i=(n,a)=>{if(n instanceof T.tuple){let o=new T.tuple(n.map(c=>i(c,a)));if(!T.hasattr(n,"_fields"))return o;throw new l.Error("Not implemented.")}else{if(Array.isArray(n))return n.map(o=>i(o,a));if(n instanceof T.dict){let o=new T.dict;for(let[c,u]of n)o.__setitem__(c,i(u,a));return o}else if(n instanceof T.slice)throw new l.Error("Not implemented.")}return a(n)};for(let n of this._input_nodes.keys())n.users.pop(this);this._input_nodes=new T.dict,this._args=i(e,s),this._kwargs=i(t,s)}}),r.fx.Node=r.fx.node.Node,r.fx.graph.Node=r.fx.node.Node,this.registerType("torch.fx.graph.Graph",class{constructor(e,t,s){this._root=new r.fx.node.Node(m,"","root","",new T.list,new T.dict),this._used_names=new Map,this._len=0,this._graph_namespace=new r.fx.graph._Namespace,this._owning_module=e,this._tracer_cls=t,this._tracer_extras=s}get nodes(){let e=new Array(this._len),t=this._root.next;for(let s=0;t!==this._root;s++)e[s]=t,t=t.next;return e}placeholder(e,t){let s=[],i=new T.dict;return this.create_node("placeholder",e,s,i,t)}create_node(e,t,s,i,n,a){s=s||new T.tuple,i=i||new T.dict;let o=n||this._target_to_str(t);n=this._graph_namespace.create_name(o,null);let c=new r.fx.node.Node(this,n,e,t,s,i,a);return this._graph_namespace.associate_name_with_obj(n,c),this._insert(c),this._len+=1,c}_insert(e){this._root.prepend(e)}output(e,t){return this.create_node("output","output",new T.tuple(e),null,t)}_target_to_str(e){return typeof e=="string"?e.startsWith("__")&&e.endsWith("__")&&(e=e.substring(2,e.length-2)):e=e.__name__,this._snake_case(e)}_snake_case(e){let t=[],s=!1;for(let i of e){let n=i.toLowerCase();s&&n!==i?t.push("_"):s=!0,t.push(n)}return t.join("")}}),this.registerType("torch.fx.graph_module._CodeOnlyModule",class extends r.nn.modules.module.Module{constructor(e){super();for(let[t,s]of e.items())T.setattr(this,t,s)}}),this.registerType("torch.fx.graph_module.GraphModule",class extends r.nn.modules.module.Module{constructor(e,t,s){super(),this.__class__.__name__=s||"GraphModule",this.graph=t}}),r.fx.Graph=r.fx.graph.Graph,r.fx.GraphModule=r.fx.graph_module.GraphModule,this.registerType("torch.fx.immutable_collections.immutable_dict",class extends T.dict{}),this.registerFunction("torch.fx._symbolic_trace.wrap",e=>e),this.registerFunction("torch.fx._symbolic_trace._assert_is_none"),this.registerFunction("torchvision.datasets.folder.default_loader"),this.registerType("torchvision.datasets.folder.ImageFolder",class{}),this.registerType("torchvision.datasets.mnist.FashionMNIST",class{}),this.registerType("torchvision.datasets.mnist.MNIST",class{}),this.registerType("torchvision.datasets.video_utils.VideoClips",class{}),this.registerType("torchvision.datasets.vision.StandardTransform",class{}),this.registerType("torchvision.ops.deform_conv.DeformConv2d",class{}),this.registerType("torchvision.ops.feature_pyramid_network.FeaturePyramidNetwork",class{}),this.registerType("torchvision.ops.feature_pyramid_network.LastLevelMaxPool",class{}),this.registerType("torchvision.ops.feature_pyramid_network.LastLevelP6P7",class{}),this.registerType("torchvision.ops.misc.Conv2dNormActivation",class{}),this.registerType("torchvision.ops.misc.ConvNormActivation",class{}),this.registerType("torchvision.ops.misc.MLP",class extends r.nn.modules.container.Sequential{}),this.registerType("torchvision.ops.misc.ConvTranspose2d",class{}),this.registerType("torchvision.ops.misc.FrozenBatchNorm2d",class{}),this.registerType("torchvision.ops.misc.Permute",class{}),this.registerType("torchvision.ops.misc.SqueezeExcitation",class{}),this.registerType("torchvision.ops.poolers.LevelMapper",class{}),this.registerType("torchvision.ops.poolers.MultiScaleRoIAlign",class{}),this.registerType("torchvision.ops.roi_align.RoIAlign",class{}),this.registerType("torchvision.ops.stochastic_depth.StochasticDepth",class{}),this.registerType("torchvision.models._api.Weights",class{}),this.registerType("torchvision.models.alexnet.AlexNet",class{}),this.registerType("torchvision.models.convnext.ConvNeXt",class{}),this.registerType("torchvision.models.convnext.CNBlock",class{}),this.registerType("torchvision.models.convnext.LayerNorm2d",class{}),this.registerType("torchvision.models.densenet.DenseNet",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.models.densenet._DenseBlock",class extends r.nn.modules.container.ModuleDict{}),this.registerType("torchvision.models.densenet._DenseLayer",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.models.densenet._Transition",class extends r.nn.modules.container.Sequential{}),this.registerType("torchvision.models.detection._utils.BalancedPositiveNegativeSampler",class{}),this.registerType("torchvision.models.detection._utils.BoxCoder",class{}),this.registerType("torchvision.models.detection._utils.Matcher",class{}),this.registerType("torchvision.models.detection._utils.SSDMatcher",class{}),this.registerType("torchvision.models.detection.anchor_utils.AnchorGenerator",class{}),this.registerType("torchvision.models.detection.anchor_utils.DefaultBoxGenerator",class{}),this.registerType("torchvision.models.detection.backbone_utils.BackboneWithFPN",class{}),this.registerType("torchvision.models.detection.faster_rcnn.FasterRCNN",class{}),this.registerType("torchvision.models.detection.faster_rcnn.FastRCNNConvFCHead",class{}),this.registerType("torchvision.models.detection.faster_rcnn.FastRCNNPredictor",class{}),this.registerType("torchvision.models.detection.faster_rcnn.TwoMLPHead",class{}),this.registerType("torchvision.models.detection.fcos.FCOS",class{}),this.registerType("torchvision.models.detection.fcos.FCOSHead",class{}),this.registerType("torchvision.models.detection.fcos.FCOSClassificationHead",class{}),this.registerType("torchvision.models.detection.fcos.FCOSRegressionHead",class{}),this.registerType("torchvision.models.detection._utils.BoxLinearCoder",class{}),this.registerType("torchvision.models.detection.keypoint_rcnn.KeypointRCNN",class{}),this.registerType("torchvision.models.detection.keypoint_rcnn.KeypointRCNNHeads",class{}),this.registerType("torchvision.models.detection.keypoint_rcnn.KeypointRCNNPredictor",class{}),this.registerType("torchvision.models.detection.mask_rcnn.MaskRCNN",class{}),this.registerType("torchvision.models.detection.mask_rcnn.MaskRCNNHeads",class{}),this.registerType("torchvision.models.detection.mask_rcnn.MaskRCNNPredictor",class{}),this.registerType("torchvision.models.detection.retinanet.RetinaNet",class{}),this.registerType("torchvision.models.detection.retinanet.RetinaNetClassificationHead",class{}),this.registerType("torchvision.models.detection.retinanet.RetinaNetHead",class{}),this.registerType("torchvision.models.detection.retinanet.RetinaNetRegressionHead",class{}),this.registerType("torchvision.models.detection.roi_heads.RoIHeads",class{}),this.registerType("torchvision.models.detection.rpn.AnchorGenerator",class{}),this.registerType("torchvision.models.detection.rpn.RegionProposalNetwork",class{}),this.registerType("torchvision.models.detection.rpn.RPNHead",class{}),this.registerType("torchvision.models.detection.ssd.SSD",class{}),this.registerType("torchvision.models.detection.ssd.SSDClassificationHead",class{}),this.registerType("torchvision.models.detection.ssd.SSDHead",class{}),this.registerType("torchvision.models.detection.ssd.SSDFeatureExtractorVGG",class{}),this.registerType("torchvision.models.detection.ssd.SSDRegressionHead",class{}),this.registerType("torchvision.models.detection.ssdlite.SSDLiteClassificationHead",class{}),this.registerType("torchvision.models.detection.ssdlite.SSDLiteFeatureExtractorMobileNet",class{}),this.registerType("torchvision.models.detection.ssdlite.SSDLiteHead",class{}),this.registerType("torchvision.models.detection.ssdlite.SSDLiteRegressionHead",class{}),this.registerType("torchvision.models.detection.transform.GeneralizedRCNNTransform",class{}),this.registerType("torchvision.models.efficientnet.EfficientNet",class{}),this.registerType("torchvision.models.efficientnet.EfficientNet_B3_Weights",class{}),this.registerType("torchvision.models.efficientnet.FusedMBConv",class{}),this.registerType("torchvision.models.efficientnet.MBConv",class{}),this.registerType("torchvision.models.feature_extraction.LeafModuleAwareTracer",class extends r.fx._symbolic_trace.Tracer{}),this.registerType("torchvision.models.feature_extraction.NodePathTracer",class extends te.models.feature_extraction.LeafModuleAwareTracer{}),this.registerType("torchvision.models.googlenet.BasicConv2d",class{}),this.registerType("torchvision.models.googlenet.GoogLeNet",class{}),this.registerType("torchvision.models.googlenet.Inception",class{}),this.registerType("torchvision.models.googlenet.InceptionAux",class{}),this.registerType("torchvision.models.inception.BasicConv2d",class{}),this.registerType("torchvision.models.inception.Inception3",class{}),this.registerType("torchvision.models.inception.InceptionAux",class{}),this.registerType("torchvision.models.inception.InceptionA",class{}),this.registerType("torchvision.models.inception.InceptionB",class{}),this.registerType("torchvision.models.inception.InceptionC",class{}),this.registerType("torchvision.models.inception.InceptionD",class{}),this.registerType("torchvision.models.inception.InceptionE",class{}),this.registerFunction("torchvision.models.inception.inception_v3"),this.registerType("torchvision.models.mnasnet._InvertedResidual",class{}),this.registerType("torchvision.models.mnasnet.MNASNet",class{}),this.registerType("torchvision.models.maxvit.MaxVit",class{}),this.registerType("torchvision.models.maxvit.MaxVitBlock",class{}),this.registerType("torchvision.models.maxvit.MaxVitLayer",class{}),this.registerType("torchvision.models.maxvit.MBConv",class{}),this.registerType("torchvision.models.maxvit.PartitionAttentionLayer",class{}),this.registerType("torchvision.models.maxvit.RelativePositionalMultiHeadAttention",class{}),this.registerType("torchvision.models.maxvit.SwapAxes",class{}),this.registerType("torchvision.models.maxvit.WindowDepartition",class{}),this.registerType("torchvision.models.mobilenet.ConvBNReLU",class{}),this.registerType("torchvision.models.mobilenet.MobileNetV2",class{}),this.registerType("torchvision.models.mobilenet.InvertedResidual",class{}),this.registerType("torchvision.models.mobilenetv2.ConvBNActivation",class{}),this.registerType("torchvision.models.mobilenetv2.InvertedResidual",class{}),this.registerType("torchvision.models.mobilenetv2.MobileNetV2",class{}),this.registerType("torchvision.models.mobilenetv3.InvertedResidual",class{}),this.registerType("torchvision.models.mobilenetv3.MobileNetV3",class{}),this.registerType("torchvision.models.mobilenetv3.SqueezeExcitation",class{}),this.registerType("torchvision.models.regnet.AnyStage",class extends r.nn.modules.container.Sequential{}),this.registerType("torchvision.models.regnet.BottleneckTransform",class{}),this.registerType("torchvision.models.regnet.ResBottleneckBlock",class{}),this.registerType("torchvision.models.regnet.RegNet",class{}),this.registerType("torchvision.models.regnet.SimpleStemIN",class{}),this.registerType("torchvision.models.resnet.Bottleneck",class{}),this.registerType("torchvision.models.resnet.BasicBlock",class{}),this.registerType("torchvision.models.quantization.mobilenet.QuantizableInvertedResidual",class{}),this.registerType("torchvision.models.quantization.mobilenet.QuantizableMobileNetV2",class{}),this.registerType("torchvision.models.quantization.mobilenetv2.QuantizableInvertedResidual",class{}),this.registerType("torchvision.models.quantization.mobilenetv2.QuantizableMobileNetV2",class{}),this.registerType("torchvision.models.quantization.mobilenetv3.QuantizableMobileNetV3",class{}),this.registerType("torchvision.models.quantization.mobilenetv3.QuantizableInvertedResidual",class{}),this.registerType("torchvision.models.quantization.mobilenetv3.QuantizableSqueezeExcitation",class{}),this.registerType("torchvision.models.quantization.resnet.QuantizableBasicBlock",class{}),this.registerType("torchvision.models.quantization.resnet.QuantizableBottleneck",class{}),this.registerType("torchvision.models.quantization.resnet.QuantizableResNet",class{}),this.registerType("torchvision.models.segmentation.deeplabv3.ASPP",class{}),this.registerType("torchvision.models.segmentation.deeplabv3.ASPPConv",class{}),this.registerType("torchvision.models.segmentation.deeplabv3.ASPPPooling",class{}),this.registerType("torchvision.models.segmentation.deeplabv3.DeepLabHead",class{}),this.registerType("torchvision.models.segmentation.deeplabv3.DeepLabV3",class{}),this.registerType("torchvision.models.segmentation.fcn.FCN",class{}),this.registerType("torchvision.models.segmentation.fcn.FCNHead",class{}),this.registerType("torchvision.models.segmentation.lraspp.LRASPP",class{}),this.registerType("torchvision.models.segmentation.lraspp.LRASPPHead",class{}),this.registerType("torchvision.models.shufflenetv2.ShuffleNetV2",class{}),this.registerType("torchvision.models.shufflenetv2.InvertedResidual",class{}),this.registerType("torchvision.models.squeezenet.Fire",class{}),this.registerType("torchvision.models.squeezenet.SqueezeNet",class{}),this.registerType("torchvision.models.swin_transformer.PatchMerging",class{}),this.registerType("torchvision.models.swin_transformer.PatchMergingV2",class{}),this.registerType("torchvision.models.swin_transformer.ShiftedWindowAttention",class{}),this.registerType("torchvision.models.swin_transformer.ShiftedWindowAttentionV2",class{}),this.registerType("torchvision.models.swin_transformer.SwinTransformer",class{}),this.registerType("torchvision.models.swin_transformer.SwinTransformerBlock",class{}),this.registerType("torchvision.models.swin_transformer.SwinTransformerBlockV2",class{}),this.registerType("torchvision.models.resnet.ResNet",class{}),this.registerType("torchvision.models.vgg.VGG",class{}),this.registerType("torchvision.models.video.resnet.BasicBlock",class{}),this.registerType("torchvision.models.video.resnet.BasicStem",class{}),this.registerType("torchvision.models.video.resnet.Conv2Plus1D",class{}),this.registerType("torchvision.models.video.resnet.Conv3DNoTemporal",class{}),this.registerType("torchvision.models.video.resnet.Conv3DSimple",class{}),this.registerType("torchvision.models.video.resnet.R2Plus1dStem",class{}),this.registerType("torchvision.models.video.resnet.VideoResNet",class{}),this.registerType("torchvision.models.vision_transformer.Encoder",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.models.vision_transformer.EncoderBlock",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.models.vision_transformer.MLPBlock",class extends te.ops.misc.MLP{}),this.registerType("torchvision.models.vision_transformer.VisionTransformer",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.models._utils.IntermediateLayerGetter",class{}),this.registerType("torchvision.transforms._presets.ImageClassification",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.transforms.autoaugment.AutoAugment",class{}),this.registerType("torchvision.transforms.autoaugment.AutoAugmentPolicy",class{}),this.registerType("torchvision.transforms.autoaugment.AugMix",class{}),this.registerType("torchvision.transforms.functional.InterpolationMode",class{}),this.registerFunction("torchvision.transforms.functional.adjust_brightness"),this.registerFunction("torchvision.transforms.functional.adjust_contrast"),this.registerFunction("torchvision.transforms.functional.adjust_brightness"),this.registerFunction("torchvision.transforms.functional.adjust_contrast"),this.registerFunction("torchvision.transforms.functional.adjust_gamma"),this.registerFunction("torchvision.transforms.functional.adjust_hue"),this.registerFunction("torchvision.transforms.functional.adjust_saturation"),this.registerType("torchvision.transforms.transforms.ColorJitter",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.transforms.transforms.Compose",class{}),this.registerType("torchvision.transforms.transforms.ConvertImageDtype",class{}),this.registerType("torchvision.transforms.transforms.CenterCrop",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.transforms.transforms.GaussianBlur",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.transforms.transforms.Grayscale",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.transforms.transforms.Lambda",class{}),this.registerType("torchvision.transforms.transforms.Normalize",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.transforms.transforms.PILToTensor",class{}),this.registerType("torchvision.transforms.transforms.RandomAffine",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.transforms.transforms.RandomApply",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.transforms.transforms.RandomCrop",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.transforms.transforms.RandomChoice",class{}),this.registerType("torchvision.transforms.transforms.RandomErasing",class{}),this.registerType("torchvision.transforms.transforms.RandomInvert",class{}),this.registerType("torchvision.transforms.transforms.RandomPerspective",class{}),this.registerType("torchvision.transforms.transforms.RandomHorizontalFlip",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.transforms.transforms.RandomVerticalFlip",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.transforms.transforms.RandomResizedCrop",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.transforms.transforms.RandomRotation",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.transforms.transforms.Resize",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.transforms.transforms.Scale",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.transforms.transforms.ToPILImage",class{}),this.registerType("torchvision.transforms.transforms.ToTensor",class{}),this.registerType("torchvision.transforms.v2._color.Grayscale",class{}),this.registerType("torchvision.transforms.v2._container.Compose",class{}),this.registerType("torchvision.transforms.v2._misc.ConvertImageDtype",class{}),this.registerType("torchvision.transforms.v2._misc.Normalize",class{}),this.registerType("torchvision.transforms.v2._misc.ToDtype",class{}),this.registerType("torchvision.transforms.v2._geometry.CenterCrop",class{}),this.registerType("torchvision.transforms.v2._geometry.Resize",class{}),this.registerType("torchvision.transforms.v2._geometry.Pad",class{}),this.registerType("torchvision.transforms.v2._geometry.RandomCrop",class{}),this.registerType("torchvision.transforms.v2._transform.Transform",class extends r.nn.modules.module.Module{}),this.registerType("torchvision.transforms.v2._type_conversion.ToImage",class extends te.transforms.v2._transform.Transform{}),this.registerType("torchvision.transforms.v2._type_conversion.PILToTensor",class{}),this.registerFunction("torchvision.models.resnet.resnet18",()=>{}),this.registerFunction("torchvision.models.resnet.resnet34",()=>{}),this.registerFunction("torchvision.models.resnet.resnet50",()=>{}),this.registerFunction("torchvision.models.resnet.resnet101",()=>{}),this.registerFunction("torchvision.models.resnet.resnet152",()=>{}),this.registerFunction("torchvision.models.vision_transformer.vit_h_14",()=>{}),this.registerFunction("torchvision.ops.boxes.box_iou"),this.registerFunction("builtins.annotate",(e,t)=>e===T.int?Number.isInteger(t)?t:NaN:e===T.float?typeof t=="number"?t:NaN:(T.number,t)),this.registerFunction("builtins.uninitialized",()=>{}),this.registerFunction("ops.prim.unchecked_cast",(e,t)=>t),this.registerFunction("ops.prim.data",e=>e),this.registerFunction("ops.prim.device",e=>e.device),this.registerFunction("ops.prim.dtype",e=>e.dtype.scalar_type()),this.registerFunction("ops.prim.is_quantized",e=>e.is_quantized),this.registerFunction("ops.prim.is_cuda",()=>!1),this.registerFunction("ops.prim.is_nested",e=>e.is_nested),this.registerFunction("ops.prim.is_sparse",e=>e.is_sparse),this.registerFunction("ops.prim.unchecked_unwrap_optional",e=>e),this.registerFunction("ops.prim.NumToTensor",e=>{let t=m.invoke("torch.Tensor",[]);return t.value=e,t}),this.registerFunction("ops.prim.min",(...e)=>Array.isArray(e[0])?Math.min.apply(null,e[0]):Math.min.apply(null,e)),this.registerFunction("ops.prim.max",(...e)=>Array.isArray(e[0])?Math.max.apply(null,e[0]):Math.max.apply(null,e)),this.registerFunction("ops.prim.shape",e=>e&&e.size?e.size():void 0),this.registerFunction("ops.quantized.conv_prepack",(e,t,s,i,n,a)=>{let o=m.invoke("__torch__.torch.classes.quantized.Conv2dPackedParamsBase",[]);return o.weight=e,o.bias=t,o.stride=s,o.padding=i,o.dilation=n,o.groups=a,o}),this.registerFunction("ops.quantized.conv1d_prepack",(e,t,s,i,n,a)=>{let o=m.invoke("__torch__.torch.classes.quantized.Conv2dPackedParamsBase",[]);return o.weight=e,o.bias=t,o.stride=s,o.padding=i,o.dilation=n,o.groups=a,o}),this.registerFunction("ops.quantized.conv2d_prepack",(e,t,s,i,n,a)=>{let o=m.invoke("__torch__.torch.classes.quantized.Conv2dPackedParamsBase",[]);return o.weight=e,o.bias=t,o.stride=s,o.padding=i,o.dilation=n,o.groups=a,o}),this.registerFunction("ops.quantized.conv3d_prepack",(e,t,s,i,n,a)=>{let o=m.invoke("__torch__.torch.classes.quantized.Conv3dPackedParamsBase",[]);return o.weight=e,o.bias=t,o.stride=s,o.padding=i,o.dilation=n,o.groups=a,o}),this.registerFunction("ops.quantized.conv_transpose1d_prepack",(e,t,s,i,n,a,o)=>{let c=m.invoke("__torch__.torch.classes.quantized.Conv2dPackedParamsBase",[]);return c.weight=e,c.bias=t,c.stride=s,c.padding=i,c.output_padding=n,c.dilation=a,c.groups=o,c}),this.registerFunction("ops.quantized.conv_transpose2d_prepack",(e,t,s,i,n,a,o)=>{let c=m.invoke("__torch__.torch.classes.quantized.Conv2dPackedParamsBase",[]);return c.weight=e,c.bias=t,c.stride=s,c.padding=i,c.output_padding=n,c.dilation=a,c.groups=o,c}),this.registerFunction("ops.quantized.linear_prepack",(e,t)=>{let s=m.invoke("__torch__.torch.classes.quantized.LinearPackedParamsBase",[]);return s.weight=e,s.bias=t,s}),this.registerFunction("ops.prim.RaiseException",e=>{throw new l.Error(e)}),this.registerFunction("builtins.range",(e,t,s)=>{if(t===void 0&&s===void 0){if(Number.isInteger(e))return Array(e).keys();if(isNaN(e))return[]}throw new l.Error(`Unsupported range(${JSON.stringify(e)}, ${JSON.stringify(t)}, ${JSON.stringify(s)})`)}),T.xrange=T.range,this.registerFunction("torch._C._nn.gelu"),this.registerFunction("torch._C._nn.avg_pool2d"),this.registerFunction("torch._C._nn.avg_pool3d"),this.registerFunction("torch._C._nn.scaled_dot_product_attention"),this.registerFunction("torch._C._nn.softplus"),this.registerFunction("torch._native_multi_head_attention"),this.registerFunction("torch._utils._rebuild_sparse_tensor",(e,t)=>{if(e===r.sparse_coo)return m.invoke("torch._sparse_coo_tensor_unsafe",t);throw new l.Error(`Unsupported sparse tensor layout '${e?e.__str__():""}'.`)}),this.registerFunction("torch._utils._get_restore_location",e=>e),this.registerFunction("torch._utils._rebuild_wrapper_subclass",(e,t,s,i,n,a,o,c)=>(o=r._utils._get_restore_location(o),r.Tensor._make_wrapper_subclass(e,s,i,t,n,a,o,c))),this.registerFunction("torch.from_numpy",e=>{let t=new Map([["<f2",r.float16],["<f4",r.float32],["<f8",r.float64],["<i2",r.int16],["<i4",r.int32],["<i8",r.int64]]);if(!t.has(e.dtype.str))throw new l.Error(`Unsupported numpy.ndarray type '${e.dtype.str}'.`);let s=t.get(e.dtype.str),i=e.strides.map(o=>o/e.itemsize),n=b.invoke("torch.storage.TypedStorage",[e.size,s]);n._set_cdata(e.data);let a=b.invoke("torch.Tensor",[]);return a.__setstate__([n,0,e.shape,i]),a}),this.registerFunction("torch._utils._rebuild_device_tensor_from_numpy",(e,t,s,i)=>{let n=b.invoke("torch.from_numpy",[e]);return n.requires_grad=i,n}),this.registerFunction("torch._sparse_coo_tensor_unsafe",(e,t,s)=>{let i=m.invoke("torch.Tensor",[]);return i._layout=r.sparse_coo,i._indices=e,i._values=t,i._shape=s,i}),this.registerFunction("torch._utils.set_tensor_metadata",(e,t)=>{r._C._set_tensor_metadata(e,t)}),this.registerFunction("torch._utils._restore_device_fake_mode",e=>e),this.registerFunction("torch._utils._rebuild_meta_tensor_no_storage",(e,t,s,i)=>r.empty_strided(t,s,e,null,"meta",!1,i)),this.registerFunction("torch._utils._rebuild_tensor",(e,t,s,i)=>{if(Array.isArray(e)&&e.length===5&&e[0]==="storage"){let[,o,,,c]=e;e=new o(c)}let n=`${e.__class__.__module__}.${e.__class__.__name__.replace("Storage","Tensor")}`,a=m.invoke(n,[]);return a.__setstate__([e,t,s,i]),a}),this.registerFunction("torch._utils._rebuild_tensor_v2",(e,t,s,i,n,a,o)=>{let c=r._utils._rebuild_tensor(e,t,s,i);return c.requires_grad=n,o&&r._utils.set_tensor_metadata(c,o),c.backward_hooks=a,c}),this.registerFunction("torch._utils._rebuild_tensor_v3",(e,t,s,i,n,a,o,c)=>{let u=new r.Tensor(null,null,o);return u.set_(e,t,s,i),c&&r._utils.set_tensor_metadata(u,c),u._backward_hooks=a,r._utils._restore_device_fake_mode(u)}),this.registerFunction("torch._utils._rebuild_parameter",(e,t,s)=>{let i=new r.nn.parameter.Parameter(e,t);return i.backward_hooks=s,i}),this.registerFunction("torch._utils._rebuild_parameter_v2",(e,t,s,i)=>{let n=new r.nn.parameter.Parameter(e,t);return n.backward_hooks=s,r._utils._set_obj_state(n,i),n}),this.registerFunction("torch._utils._rebuild_parameter_with_state",(e,t,s,i)=>{let n=(o,c)=>{let[u,d]=Array.isArray(c)?c:[c,null];if(u)for(let[_,f]of Object.entries(u))T.setattr(o,_,f);if(d)for(let[_,f]of Object.entries(d))T.setattr(o,_,f)},a=new r.nn.parameter.Parameter(e,t);return a._backward_hooks=s,n(a,i),a}),this.registerFunction("torch._utils._rebuild_qtensor",(e,t,s,i,n,a,o)=>{let c=b.invoke("torch._utils._rebuild_tensor_v2",[e,t,s,i,a,o]);return c.quantizer_params=n,c}),this.registerFunction("torch._utils._set_obj_state",(e,t)=>{let s=t,i=null;if(t instanceof m.builtins.tuple){if(t.length!==2)throw new l.Error(`Invalid serialized state: '${t}'.`);[s,i]=t}if(s)for(let[n,a]of Object.entries(s))T.setattr(e,n,a);if(i)for(let[n,a]of Object.entries(i))T.setattr(e,n,a);return e}),this.registerFunction("torch._set_item",(e,t,s)=>{e[t]=s}),this.registerFunction("torch._tensor._rebuild_from_type_v2",(e,t,s,i)=>{let n=e(...s);return n.__class__,b.invoke("builtins.getattr",[n.__class__,"__setstate__",r.Tensor.__setstate__])===r.Tensor.__setstate__?n=b.invoke("torch._utils._set_obj_state",[n,i]):n.__setstate__(i),n}),this.registerFunction("ops.aten.is_scripting",()=>!0),this.registerFunction("ops.aten.__and__",(e,t)=>e&&t),this.registerFunction("ops.aten.__contains__",(e,t)=>T.hasattr(e,t)),this.registerFunction("torch.__derive_index",(e,t,s)=>t+e*s),this.registerFunction("ops.aten.__is__",(e,t)=>e===t),this.registerFunction("ops.aten.__isnot__",(e,t)=>e!==t),this.registerFunction("ops.aten.__not__",e=>{if(Number.isInteger(e)&&(e=!!e),typeof e=="boolean")return!e;throw new l.Error("Unsupported 'ops.aten.__not__' expression type.")}),this.registerFunction("torch.__range_length",(e,t,s)=>{if(s===0)throw new l.Error("range() arg 3 must not be zero");return s>0&&e<t?1+(t-1-e)/s:s<0&&e>t?1+(e-1-t)/(0-s):0}),this.registerFunction("torch._nested_tensor_from_mask_left_aligned"),this.registerFunction("ops.aten._unwrap_optional",e=>e),this.registerFunction("torch.get_default_dtype",()=>(r._default_type=r._default_type||r.float32,r._default_type)),this.registerFunction("torch.set_default_dtype",e=>{r._default_type=e}),this.registerFunction("torch._prims_common.dtype_or_default",e=>e||r.get_default_dtype()),this.registerFunction("torch.empty_strided",(e,t,s)=>{let i=e;s=r._prims_common.dtype_or_default(s),e=i.reduce((o,c)=>o*c,1);let n=b.invoke("torch.storage.TypedStorage",[e,s]),a=b.invoke("torch.Tensor",[]);return a.__setstate__([n,0,i,t]),a}),this.registerFunction("ops.aten.add",(e,t)=>{if((typeof e=="number"||e instanceof Number)&&(typeof t=="number"||t instanceof Number))return e+t;if(Array.isArray(e)&&Array.isArray(t))return e.concat(t);if(typeof e=="string"&&typeof t=="string")return e+t;throw new l.Error("Unsupported ops.aten.add expression type.")}),this.registerFunction("torch.all",e=>{if(Array.isArray(e)&&e.length===0)return!0;throw new l.Error("Unsupported 'torch.all' expression type.")}),this.registerFunction("torch.append",(e,t)=>(e.push(t),t)),this.registerFunction("torch.clear",e=>{if(e instanceof r.Value)throw new l.Error("Invalid value.");if(Object(e)===e)for(let t of Object.keys(e))delete e[t]}),this.registerFunction("ops.aten..cosine_similarity"),this.registerFunction("ops.aten..extend",(e,t)=>{e.push(...t)}),this.registerFunction("ops.aten..insert",(e,t,s)=>(e.splice(t,0,s),s)),this.registerFunction("ops.aten..replace",(e,t,s)=>e.replace(t,s)),this.registerFunction("torch.dict",e=>{let t={};if(e)if(Array.isArray(e))for(let[s,i]of e)t[s]=i;else throw new l.Error("'torch.dict' arguments not supported.");return t}),this.registerFunction("ops.aten..dim",e=>{if(e&&e.size){let t=e.size();if(t)return t.length}return NaN}),this.registerFunction("ops.aten..numel",e=>{if(e&&e.size){let t=e.size();if(t)return t.reduce((s,i)=>s*i,1)}return NaN}),this.registerFunction("ops.aten.eq",(e,t)=>{if(typeof e=="string"&&typeof t=="string")return e===t;if((typeof e=="number"||e instanceof Number)&&(typeof t=="number"||t instanceof Number))return isNaN(e)&&isNaN(t)?!0:e===t;if(e===void 0||t===void 0)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((s,i)=>s===t[i]);throw new l.Error("Unsupported 'torch.eq' expression type.")}),this.registerFunction("ops.aten.floor",e=>Math.floor(e)),this.registerFunction("ops.aten.ceil",e=>Math.ceil(e)),this.registerFunction("ops.aten.floordiv",(e,t)=>Math.floor(e/t)),this.registerFunction("ops.aten..format",(...e)=>e.shift().split(/({}D?)/).map(s=>{if(s==="{}"||s==="{}D"){let i=e.shift();return Array.isArray(i)?`[${i.map(n=>n.toString()).join(", ")}]`:i?i.toString():"?"}return s}).join("")),this.registerFunction("ops.aten.strip",(e,t)=>{t=t||"\\n\\t\\f\\v";let s=new RegExp(`[${t}]`,"g");return e.replace(s,"")}),this.registerFunction("ops.aten.gt",(e,t)=>{if((typeof e=="number"||e instanceof Number)&&(typeof t=="number"||t instanceof Number)&&!isNaN(e)&&!isNaN(t))return e>t;if(isNaN(e)&&!isNaN(t))return!0;throw new l.Error("Unsupported 'ops.aten.gt' expression type.")}),this.registerFunction("ops.aten.ge",(e,t)=>{if((typeof e=="number"||e instanceof Number)&&(typeof t=="number"||t instanceof Number)&&!isNaN(e)&&!isNaN(t))return e>t;if(isNaN(e)&&!isNaN(t))return!0;throw new l.Error("Unsupported 'ops.aten.ge' expression type.")}),this.registerFunction("ops.aten.is_floating_point",e=>{let t=e.dtype.scalar_type();return t===5||t===6||t===7}),this.registerFunction("ops.aten.is_grad_enabled",()=>!1),this.registerFunction("ops.aten.is_autocast_enabled",()=>!1),this.registerFunction("ops.aten.isfinite"),this.registerFunction("ops.aten.set_grad_enabled",()=>{}),this.registerFunction("torch.serialization._get_layout",e=>{let t=e.startsWith("torch.")?r[e.split(".")[1]]:null;return t instanceof r.layout?t:null}),this.registerFunction("torch.storage._load_from_bytes",e=>r.load(e)),this.registerFunction("torch.jit._pickle.build_boollist",e=>e),this.registerFunction("torch.jit._pickle.build_doublelist",e=>e),this.registerFunction("torch.jit._pickle.build_intlist",e=>e),this.registerFunction("torch.jit._pickle.build_tensorlist",e=>e),this.registerFunction("torch.jit._pickle.build_tensor_from_id",e=>m.builtins.CONSTANTS[`c${e}`]),this.registerFunction("torch.jit._pickle.restore_type_tag",e=>e),this.registerFunction("ops.aten..keys",e=>Object.keys(e)),this.registerFunction("ops.aten..len",e=>Array.isArray(e)?e.length:e&&e.shape&&e.__len__?e.__len__():NaN),this.registerFunction("ops.aten..le",(e,t)=>{if((typeof e=="number"||e instanceof Number)&&(typeof t=="number"||t instanceof Number))return isNaN(e)||isNaN(t)?!1:e<=t;if(e===void 0||t===void 0)return!0;throw new l.Error("Unsupported 'torch.le' expression type.")}),this.registerFunction("ops.aten..list",e=>e),this.registerFunction("ops.aten..list_with_default",e=>e),this.registerType("torch.PyTorchFileReader",class{constructor(e){let t=0,s=Array.from(e.keys()).map(n=>n.replace(/\\/g,"/").split("/").reverse());for(let n=new Set;n&&s.length>0;)n=new Set(s.map(a=>a.length>1?a.pop():null)),n=n.size>1||n.keys().next().value===null?null:n,t+=n?n.keys().next().value.length+1:0;this._records=new Map(Array.from(e).map(([n,a])=>[n.substring(t),a])),this._version=0;let i=this.get_record(".data/version")||this.get_record("version")||null;if(i){let n=new TextDecoder("utf-8"),a=i.peek(),o=n.decode(a);this._version=Number(o.split(`
|
|
28
|
+
`).shift().trim())}}has_record(e){return this._records.has(e)}get_record(e){return this._records.get(e)}get_all_records(){return Array.from(this._records.keys())}version(){return this._version}}),this.registerFunction("torch.load",e=>{let t=n=>{let a={};if(n.has("storages")){let u=n.get("storages"),d=b.invoke("pickle.Unpickler",[u]),_=d.load();for(let f=0;f<_;f++){let g=d.load(),[y,,x]=g,F=x._new_with_file(d);a[y]=F}}if(n.has("tensors")){let u=n.get("tensors"),d=b.invoke("pickle.Unpickler",[u]),_=d.load(),f=y=>{let x=y.read(4);return x[0]+(x[1]<<8)+(x[2]<<16)+(x[3]<<24)},g=y=>{let x=y.read(8);if(x[6]!==0&&x[7]!==0)throw new l.Error("Unsigned 64-bit value exceeds 32-bit range.");return x[0]+(x[1]<<8)+(x[2]<<16)+(x[3]<<24)+x[4]*4294967296+x[5]*1099511627776};for(let y=0;y<_;y++){let x=d.load(),[F,v]=x,A=a[v],I=f(d);d.read(4);let E=Array.from(new Array(I)).map(()=>g(d)),O=Array.from(new Array(I)).map(()=>g(d)),M=g(d),G=b.invoke("torch._utils._rebuild_tensor",[A,M,E,O]);a[F]=G}}let o=n.get("pickle"),c=b.invoke("pickle.Unpickler",[o]);return c.persistent_load=u=>a[u],c.load()},s=()=>{let n=b.invoke("pickle.Unpickler",[e]);n.load();let a=n.load();if(a!==1001)throw new l.Error(`Unsupported protocol version '${a}'.`);let o=n.load();if(o.get("protocol_version")!==1001)throw new l.Error(`Unsupported protocol version '${o.protocol_version}'.`);if(o.get("little_endian")===!1)throw new l.Error("Unsupported big-endian storage data.");let c=new Map,u=new Map;n.persistent_load=f=>{switch(f[0]){case"module":{let[,g,,y]=f;return c.set(g,y),f[1]}case"storage":{let[,g,y,,x,F]=f;if(!u.has(y)){let v=new g(x);u.set(y,v)}if(F){let v=F.shift();return F.shift(),F.shift(),u.has(v)||u.set(v,null),u.get(v)}return u.get(y)}default:throw new l.Error(`Unsupported persistent load type '${f[0]}'.`)}};let d=n.load(),_=n.load();for(let f of _)u.get(f)._set_from_file(n);if(!d)throw new l.Error("File format is not PyTorch.");if(d==="None")throw new l.Error("File contains 'None' root object.");return d},i=n=>{if(e.has("constant.pkl"))throw l.Error("TorchScript 'torch.load' not supported.");let a=new Map,o=_=>{switch(_[0]){case"storage":{let[,f,g,,y]=_;if(!a.has(g)){let x=new f(y),F=`data/${g}`,v=n.get(F);x._set_cdata(v),a.set(g,x)}return a.get(g)}default:throw new l.Error(`Unsupported persistent load type '${_[0]}'.`)}},c=n.get("data.pkl"),u=b.invoke("pickle.Unpickler",[c]);return u.persistent_load=o,u.load()};if(e instanceof Map){let n=new r.PyTorchFileReader(e),a=n.get_all_records().map(o=>[o,n.get_record(o)]);if(e=new Map(a),e.has("pickle"))return t(e);if(e.has("data.pkl"))return i(e);throw new l.Error(`Unsupported 'torch.load' input '${JSON.stringify(Array.from(e.keys()))}'.`)}return s(e)}),this.registerFunction("ops.aten.log10",e=>Math.log10(e)),this.registerFunction("ops.aten.device",(e,t)=>new r.device(e,t)),this.registerFunction("ops.aten.lt",(e,t)=>{if((typeof e=="number"||e instanceof Number)&&(typeof t=="number"||t instanceof Number))return e<t;throw new l.Error("Unsupported 'ops.aten.lt' expression type.")}),this.registerFunction("ops.aten.mul",(e,t)=>{if((typeof e=="number"||e instanceof Number)&&(typeof t=="number"||t instanceof Number))return e*t;if(isNaN(e)||isNaN(t))return NaN;if(Array.isArray(e)&&e.every(s=>typeof s=="number"||s instanceof Number)&&(typeof t=="number"||t instanceof Number))return e.map(s=>s*t);throw new l.Error("Unsupported 'ops.aten.mul' expression type.")}),this.registerFunction("ops.aten.div",(e,t)=>{if((typeof e=="number"||e instanceof Number)&&(typeof t=="number"||t instanceof Number))return e/t;if(isNaN(e)||isNaN(t))return NaN;throw new l.Error("Unsupported 'ops.aten.div' expression type.")}),this.registerFunction("torch.round",e=>{if(typeof e=="number"||e instanceof Number)return Math.round(e);if(isNaN(e))return e;throw new l.Error("Unsupported 'torch.round' expression type.")}),this.registerFunction("ops.aten.remainder",(e,t)=>{if((typeof e=="number"||e instanceof Number)&&(typeof t=="number"||t instanceof Number))return e%t;if(isNaN(e)||isNaN(t))return NaN;throw new l.Error("Unsupported 'ops.aten.remainder' expression type.")}),this.registerFunction("ops.aten.ne",(e,t)=>{if(typeof e=="boolean"&&typeof t=="boolean")return e!==t;if((typeof e=="number"||e instanceof Number)&&(typeof t=="number"||t instanceof Number))return isNaN(e)||isNaN(t)?!1:e!==t;if(Array.isArray(e)&&Array.isArray(t)&&e.length===t.length)return!1;if(typeof e=="string"&&typeof t=="string")return e!==t;if(e===void 0||t===void 0)return!0;throw new l.Error("Unsupported 'ops.aten.ne' expression type.")}),this.registerFunction("ops.aten.neg",e=>{if(typeof e=="number")return-e;throw new l.Error("Unsupported 'ops.aten.neg' expression type.")}),this.registerFunction("ops.aten.pow",(e,t)=>{if((typeof e=="number"||e instanceof Number)&&(typeof t=="number"||t instanceof Number))return Math.pow(e,t);throw new l.Error("Unsupported 'ops.aten.pow' expression type.")}),this.registerFunction("torch.q_scale",()=>-1),this.registerFunction("torch.t",e=>e),this.registerFunction("ops.aten.size",(e,t)=>{if(e&&e.size){let s=e.size();if(Array.isArray(s)){if(t===void 0)return s;if(Number.isInteger(t)){if(t>=0&&t<s.length)return s[t];if(t<0&&-t<s.length)return s[s.length+t]}throw new l.Error(`Dimension out of range (expected to be in range of ${JSON.stringify(s)}, but got ${JSON.stringify(t)}).`)}}return Number.isInteger(t)?NaN:[]}),this.registerFunction("ops.aten.sqrt",e=>Math.sqrt(e)),this.registerFunction("ops.aten.slice",(e,t,s,i)=>{if(!Array.isArray(e))throw new l.Error("Slicing expected array");if(i=i||1,i!==1)throw new l.Error("Slicing only supports step=1");return t=Math.max(0,t>=0?t:e.length+t),s=Math.min(e.length,s||Number.MAX_SAFE_INTEGER),e.slice(t,s)}),this.registerFunction("ops.aten.sub",(e,t)=>{if((typeof e=="number"||e instanceof Number)&&(typeof t=="number"||t instanceof Number))return e-t;throw new l.Error("Unsupported 'torch.sub' expression type.")}),this.registerFunction("torch.sym_int"),this.registerFunction("torch.sym_ite"),this.registerFunction("torch.sym_max"),this.registerFunction("torch.sym_min"),this.registerFunction("torch.sym_not"),this.registerFunction("torch.sym_sqrt"),this.registerFunction("torch.sym_sqrt"),this.registerFunction("torch.functional.einsum"),this.registerFunction("torch.functional.norm"),this.registerFunction("torch.functional.split"),this.registerFunction("torch.nn.init.constant_"),this.registerFunction("torch.nn.init.normal_"),this.registerFunction("torch.nn.init.xavier_uniform_"),this.registerFunction("torch.nn.functional.adaptive_avg_pool2d"),this.registerFunction("torch.nn.functional.binary_cross_entropy"),this.registerFunction("torch.nn.functional.binary_cross_entropy_with_logits"),this.registerFunction("torch.nn.functional.cross_entropy"),this.registerFunction("torch.nn.functional.elu"),this.registerFunction("torch.nn.functional.gelu"),this.registerFunction("torch.nn.functional.hardsigmoid"),this.registerFunction("torch.nn.functional.hardswish"),this.registerFunction("torch.nn.functional.hardtanh"),this.registerFunction("torch.nn.functional.interpolate"),this.registerFunction("torch.nn.functional.leaky_relu"),this.registerFunction("torch.nn.functional.l1_loss"),this.registerFunction("torch.nn.functional.linear"),this.registerFunction("torch.nn.functional.log_softmax"),this.registerFunction("torch.nn.functional._max_pool2d"),this.registerFunction("torch.nn.functional.max_pool2d_with_indices"),this.registerFunction("torch.nn.functional.mse_loss"),this.registerFunction("torch.nn.functional.pad"),this.registerFunction("torch.nn.functional.relu"),this.registerFunction("torch.nn.functional.relu6"),this.registerFunction("torch.nn.functional.sigmoid"),this.registerFunction("torch.nn.functional.silu"),this.registerFunction("torch.nn.functional.softmax"),this.registerFunction("torch.nn.functional.tanh"),this.registerFunction("torch.values",e=>Object.values(e)),this.registerFunction("torch.warn",()=>{}),this.registerType("torch._ops.OperatorBase",class{constructor(){this.functorch_table={}}}),this.registerType("torch._ops.HigherOrderOperator",class extends r._ops.OperatorBase{constructor(e,t){super(),this._name=e,this.__name__=e,this._ns="higher_order",this.__module__="torch.ops.higher_order",this._cacheable=t}}),this.registerType("torch.Type",class{constructor(e,t){this._kind=e,t&&(this._annotation_str=t)}static get(e,t){return r.Type.cache=r.Type.cache||new Map,t?new r.Type(e,t):(r.Type.cache.has(e)||r.Type.cache.set(e,new r.Type(e)),r.Type.cache.get(e))}kind(){return this._kind}get annotation_str(){return this._annotation_str}equals(e){return this.kind()===e.kind()}isSubtypeOf(e){return e.kind()==="AnyType"||this===e?!0:e instanceof r.OptionalType&&!(this instanceof r.OptionalType)?this.isSubtypeOf(e.getElementType()):e instanceof r.UnionType?e.containedTypes().some(t=>this.isSubtypeOf(t)):e instanceof r._C.DynamicType?r._C.DynamicType.create(this).isSubtypeOf(e):this.equals(e)}containedTypes(){return[]}withContained(e){let t=this.containedTypes();return r._C.TORCH_INTERNAL_ASSERT(t.length>0&&t.length===e.length),t.length===e.length&&t.every((s,i)=>s===e[i])?this:this.createWithContained(e)}createWithContained(){throw new l.Error("Not implemented.")}isUnionType(){return!1}hasFreeVariables(){return!1}is_module(){return!1}expect(e){return r._C.AT_ASSERT(this instanceof e),this}str(){if(this instanceof r._C.VarType&&this._annotation_str)return this._annotation_str;if(this._kind==="ScalarTypeType")return"ScalarType";if(this._kind==="QSchemeType")return"QScheme";if(this._kind)return this._kind;throw new l.Error(`Not implemented '${this.kind()}'.`)}__str__(){return this.str()}toString(){return this.__str__()}}),this.registerType("torch.ClassType",class extends r.Type{constructor(e,t,s){super("ClassType",typeof e=="string"?e:e.qualifiedName()),this._name=typeof e=="string"?new r._C.QualifiedName(e):e,this._is_module=s,this._attributes=[],this._attributeTypes=[],this._methods=[],this._staticmethods=new Map,this._forward_hooks=[],this._forward_pre_hooks=[],this._properties=[],this._constants=new Map}static create(e,t,s){return new r.ClassType(e,t,s)}qualified_name(){return this.annotation_str}name(){return this._name}is_module(){return this._is_module}is_parameter(e){return this._attributes[e].is_parameter===!0}is_buffer(e){return this._attributes[e].is_buffer===!0}addMethod(e){r._C.TORCH_CHECK(this.findMethod(e.name())===null),this._methods.push(e)}findMethod(e){for(let t of this._methods)if(e===t.name())return t;return null}getMethod(e){let t=this.findMethod(e);if(!t)throw new l.Error(`Method '${e}' not found on class '${this.str()}.`);return t}methods(){return this._methods}addStaticMethod(e){this._staticmethods.set(e.name,e)}findStaticMethod(e){return this._staticmethods.get(e)}findHook(e){let t=this.findForwardHook(e);return t===null&&(t=this.findForwardPreHook(e)),t}findForwardHook(e){for(let t of this._forward_hooks)if(e===t.name())return t;return null}findForwardPreHook(e){for(let t of this._forward_pre_hooks)if(e===t.name())return t;return null}numAttributes(){return this._attributes.length}addAttribute(e,t,s,i){s=s||!1,i=i||!1;let n=this._attributes.length;return this._attributes.push({name:e,type:t,is_parameter:s,is_buffer:i}),this._attributeTypes.push(t),n}addOrCheckAttribute(e,t,s,i){s=s||!1,i=i||!1;let n=this.findAttributeSlot(e);return n===null?this.addAttribute(e,t,s,i):n}findAttributeSlot(e){for(let t=0;t<this._attributes.length;t++)if(e===this._attributes[t].name)return t;return null}findAttribute(e){let t=this.findAttributeSlot(e);return t!==null?this._attributes[t].type:null}hasAttribute(e){return this._attributes.find(t=>t.name===e)}getAttribute(e){let t=Number.isInteger(e)?e:this.findAttributeSlot(e);return this._attributes[t].type}getAttributeName(e){return this._attributes[e].name}addConstant(e,t){this._constants.set(e,t)}hasConstant(e){return this._constants.has(e)}getProperty(e){for(let t of this._properties)if(e===t.name)return t;return null}containedTypes(){return this._attributeTypes}createWithContained(e){let t=r.ClassType.create(this.name(),this._compilation_unit,this.is_module());r._C.AT_ASSERT(this.numAttributes()===e.length);for(let s=0;s<this._attributes.length;s++)r._C.AT_ASSERT(this._attributes[s].type.isSubtypeOf(e[s])),t.addAttribute(this._attributes[s].name,e[s]);for(let s of this.methods())t.addMethod(s);return t}str(){return this.qualified_name()}}),this.registerType("torch.EnumType",class extends r.Type{constructor(e,t,s,i){super("EnumType",e),this._name=e,this._value_type=t,this._enum_names_values=s,this._cu=i}static create(e,t,s,i){return t instanceof r.IntType||t instanceof r.FloatType||t instanceof r.StringType?new r.EnumType(e,t,s,i):(r._C.TORCH_CHECK(!1),null)}name(){return this._name}get annotation_str(){return this._name.qualifiedName()}enumNamesValues(){return this._enum_names_values}compilation_unit(){return this._cu}getValueType(){return this._value_type}equals(e){return e instanceof r.EnumType?this.name()&&this.name()===e.name()&&this.getValueType()===e.getValueType()&&this.compilation_unit()===e.compilation_unit():!1}isSubtypeOf(e){return e instanceof r.AnyType||e.kind()==="AnyEnumType"||this===e?!0:super.isSubtypeOf(e)}}),this.registerFunction("torch._C.standardizeVectorForUnion",(...e)=>{if(e.length===1){let[t]=e;r._C.TORCH_INTERNAL_ASSERT(t!==null);let s=[];r._C.standardizeVectorForUnion(t,s),t.splice(0,t.length),t.push(...s)}else if(e.length===2){let[t,s]=e;for(let i of t)r._C.flattenUnion(i,s);r._C.filterDuplicateSubtypes(s),r._C.sortUnion(s)}else throw new l.Error("Not implemented.")}),this.registerFunction("torch._C.flattenUnion",(e,t)=>{if(e instanceof r.UnionType)for(let s of e.containedTypes())r._C.flattenUnion(s,t);else if(e instanceof r.OptionalType){let s=e.getElementType();r._C.flattenUnion(s,t),t.push(r.NoneType.get())}else e instanceof r.NumberType?(t.push(r.IntType.get()),t.push(r.FloatType.get()),t.push(r.ComplexType.get())):t.push(e)}),this.registerFunction("torch._C.filterDuplicateSubtypes",e=>{e.length}),this.registerFunction("torch._C.sortUnion",()=>{}),this.registerType("torch.UnionType",class extends r.Type{constructor(e,t){if(super(t||"UnionType"),r._C.TORCH_INTERNAL_ASSERT(e.length>0),this._types=[],r._C.standardizeVectorForUnion(e,this._types),this._types.length===1)throw new l.Error("Invalid union type reference.");this._can_hold_none=!1,this._has_free_variables=!1;for(let s of this._types)s instanceof r.NoneType&&(this._can_hold_none=!0),s.hasFreeVariables()&&(this._has_free_variables=!0)}static create(e){return new r.UnionType(e)}containedTypes(){return this._types}isUnionType(){return!0}hasFreeVariables(){return this._has_free_variables}equals(e){if(e instanceof r.UnionType)return e.containedTypes().length!==this.containedTypes().length?!1:this.containedTypes().every(t=>e.containedTypes().some(s=>t===s));if(e instanceof r.OptionalType){if(e.getElementType()===r.NumberType.get())return this.containedTypes().length===4&&this._can_hold_none&&this.canHoldType(r.NumberType.get());let t=this.toOptional();return t&&e===t.expect(r.OptionalType)}else if(e instanceof r.NumberType)return this.containedTypes().length===3&&this.canHoldType(r.NumberType.get());return!1}isSubtypeOf(e){let t=[];if(e instanceof r.UnionType){if(this.containedTypes()===e.containedTypes())return!0;for(let s of e.containedTypes())t.push(s)}else if(e instanceof r.OptionalType)if(t.push(r.NoneType.get()),e.getElementType()===r.NumberType.get()){let s=[r.IntType.get(),r.FloatType.get(),r.ComplexType.get()];t.push(...s)}else t.push(e.getElementType());else if(e instanceof r.NumberType){let s=[r.IntType.get(),r.FloatType.get(),r.ComplexType.get()];t.push(...s)}else t.push(e);return this.containedTypes().every(s=>t.some(i=>s.isSubtypeOf(i)))}}),this.registerType("torch.OptionalType",class extends r.UnionType{constructor(e){super([e,r.NoneType.get()],"OptionalType");let t=!1;if(e instanceof r.UnionType&&(t=e.containedTypes().length===3&&e.canHoldType(r.NumberType.get())),super.containedTypes().length===2)this._contained=super.containedTypes()[0]instanceof r.NoneType?super.containedTypes()[1]:super.containedTypes()[0];else if(e===r.NumberType.get()||t)this._contained=r.NumberType.get(),this._types.splice(0,this._types.length),this._types.push(r.NumberType.get()),this._types.push(r.NoneType.get());else{let s=[r.NoneType.get()],i=this.subtractTypeSetFrom(s,this._types);this._contained=r.UnionType.create([i])}this._has_free_variables=e.hasFreeVariables()}static create(e){return new r.OptionalType(e)}getElementType(){return this._contained}equals(e){return this.kind()===e.kind()&&this.getElementType().equals(e.getElementType())}isSubtypeOf(e){if(e instanceof r.OptionalType)return this.getElementType().isSubtypeOf(e.getElementType());if(e instanceof r.UnionType)throw new l.Error("Not implemented.");return r.Type.prototype.isSubtypeOf.call(this,e)}containedTypes(){return[this._contained]}createWithContained(e){return r._C.AT_ASSERT(e.length===1),r.OptionalType.create(e[0])}subtractTypeSetFrom(e,t){let s=[],i=n=>e.some(a=>n.isSubtypeOf(a));for(let n of t)i(n)||s.push(n);return s.length===0?null:s.length===1?s[0]:r.UnionType.create(s)}str(){return`${this.getElementType().str()}?`}__str__(){return`Optional[${this.getElementType().__str__()}]`}}),this.registerType("torch.ListType",class extends r.Type{constructor(e){super("ListType"),this._elem=e}static create(e){return new r.ListType(e)}getElementType(){return this._elem}equals(e){return e instanceof r.ListType?this.getElementType().equals(e.getElementType()):!1}isSubtypeOf(e){return!!(super.isSubtypeOf(e)||e.kind()==="AnyListType")}containedTypes(){return[this._elem]}createWithContained(e){return new r.ListType(e[0])}hasFreeVariables(){return this.getElementType().hasFreeVariables()}str(){return`${this.getElementType().str()}[]`}__str__(){return`List[${this.getElementType().__str__()}]`}}),this.registerType("torch.FutureType",class extends r.Type{constructor(e){super("FutureType"),this._elem=e}static get(e){return new r.FutureType(e)}getElementType(){return this._elem}containedTypes(){throw new l.Error("Not implemented.")}str(){return`Future(${this.getElementType().str()})`}__str__(){return`Future[${this.getElementType().__str__()}]`}}),this.registerType("torch.RRefType",class extends r.Type{constructor(e){super("RRefType"),this._elem=e}get(e){return new r.RRefType(e)}getElementType(){return this._elem}containedTypes(){throw new l.Error("Not implemented.")}str(){return`RRef(${this.getElementType().str()})`}__str__(){return`RRef[${this.getElementType().__str__()}]`}}),this.registerType("torch.AwaitType",class extends r.Type{constructor(e){super("AwaitType"),this._elem=e}static get(e){return new r.AwaitType(e)}getElementType(){return this._elem}containedTypes(){throw new l.Error("Not implemented.")}str(){return`Await(${this.getElementType().str()})`}__str__(){return`Await[${this.getElementType().__str__()}]`}}),this.registerType("torch.TupleType",class extends r.Type{constructor(e,t,s){super("TupleType",t),this._elements=e,this._has_free_variables=e.some(i=>{if(!i)throw new l.Error("Can not create tuple with None type");return i.hasFreeVariables()}),this._schema=s}static create(e){return new r.TupleType(e,null,null)}static createNamed(e,t,s){let i=[];for(let a=0;a<t.length;a++){let o=new r.Argument(t[a],s[a],s[a]);i.push(o)}let n=new r.FunctionSchema(e,"",i,[]);return new r.TupleType(s,e,n)}elements(){return this._elements}name(){return this.annotation_str}containedTypes(){return this._elements}createWithContained(e){return new r.TupleType(e,this.name(),this.schema())}hasFreeVariables(){return this._has_free_variables}schema(){return this._schema}str(){return this._schema?"NamedTuple(...)":`(${this.elements().map(e=>e.str()).join(", ")})`}__str__(){return this.annotation_str?this.annotation_str:`Tuple[${this.elements().map(e=>e.__str__()).join(", ")}]`}}),this.registerType("torch.AnyType",class extends r.Type{constructor(){super("AnyType")}static get(){return r.AnyType.value=r.AnyType.value||new r.AnyType,r.AnyType.value}str(){return"Any"}__str__(){return"Any"}}),this.registerType("torch.NoneType",class extends r.Type{constructor(){super("NoneType")}static get(){return r.NoneType.value=r.NoneType.value||new r.NoneType,r.NoneType.value}equals(e){return this.kind()===e.kind()}isSubtypeOf(e){return e.kind()==="OptionalType"?!0:super.isSubtypeOf(e)}str(){return"NoneType"}__str__(){return"NoneType"}}),this.registerType("torch.TensorType",class extends r.Type{constructor(){super("TensorType"),this._is_inferred=!1}static get(){return r.TensorType.value=r.TensorType.value||new r.TensorType,r.TensorType.value}equals(e){return this.kind()===e.kind()}isInferredType(){return this._is_inferred}str(){return"Tensor"}__str__(){return"Tensor"}}),this.registerType("torch.NumberType",class extends r.Type{constructor(){super("NumberType")}static get(){return r.NumberType.value=r.NumberType.value||new r.NumberType,r.NumberType.value}str(){return"Scalar"}__str__(){return"number"}}),this.registerType("torch.BoolType",class extends r.Type{constructor(){super("BoolType")}static get(){return r.BoolType.value=r.BoolType.value||new r.BoolType,r.BoolType.value}equals(e){return this.kind()===e.kind()}str(){return"bool"}__str__(){return"bool"}}),this.registerType("torch.IntType",class extends r.Type{constructor(){super("IntType")}static get(){return r.IntType.value=r.IntType.value||new r.IntType,r.IntType.value}equals(e){return this.kind()===e.kind()}isSubtypeOf(e){return e instanceof r.NumberType||e instanceof r.FloatType||super.isSubtypeOf(e)}str(){return"int"}__str__(){return"int"}}),this.registerType("torch.SymIntType",class extends r.Type{constructor(){super("SymIntType")}static get(){return r.SymIntType.value=r.SymIntType.value||new r.SymIntType,r.SymIntType.value}equals(e){return this.kind()===e.kind()}str(){return"SymInt"}__str__(){return"int"}}),this.registerType("torch.FloatType",class extends r.Type{constructor(){super("FloatType")}static get(){return r.FloatType.value=r.FloatType.value||new r.FloatType,r.FloatType.value}equals(e){return this.kind()===e.kind()}isSubtypeOf(e){return e.kind()==="NumberType"||super.isSubtypeOf(e)}str(){return"float"}__str__(){return"float"}}),this.registerType("torch.StringType",class extends r.Type{constructor(){super("StringType")}static get(){return r.StringType.value=r.StringType.value||new r.StringType,r.StringType.value}equals(e){return this.kind()===e.kind()}str(){return"str"}__str__(){return"str"}}),this.registerType("torch.ComplexType",class extends r.Type{constructor(){super("ComplexType")}static get(){return r.ComplexType.value=r.ComplexType.value||new r.ComplexType,r.ComplexType.value}equals(e){return this.kind()===e.kind()}isSubtypeOf(e){return this.kind()==="NumberType"||super.isSubtypeOf(e)}str(){return"complex"}__str__(){return"complex"}}),this.registerType("torch.DictType",class extends r.Type{constructor(e,t){super("DictType"),this.types=[e,t]}static create(e,t){let s=e.kind();switch(e instanceof r._C.DynamicType&&(s=e.dynamicKind()),s){case"AnyType":case"IntType":case"BoolType":case"FloatType":case"ComplexType":case"StringType":case"TensorType":case"DeviceObjType":return new r.DictType(e,t);default:throw new l.Error(`Invalid dict key type '${s}'.`)}}createWithContained(e){if(e.length!==2)throw new l.Error("Expected 2 contained types.");return r.DictType.create(e[0],e[1])}getKeyType(){return this.types[0]}getValueType(){return this.types[1]}hasFreeVariables(){return this.getKeyType().hasFreeVariables()||this.getValueType().hasFreeVariables()}containedTypes(){return this.types}equals(e){return e instanceof r.DictType?this.getKeyType().equals(e.getKeyType())&&this.getValueType().equals(e.getValueType()):!1}str(){return`Dict(${this.getKeyType().str()}, ${this.getValueType().str()})`}__str__(){return`Dict(${this.getKeyType().__str__()}, ${this.getValueType().__str__()})`}}),this.registerType("torch.DeviceObjType",class extends r.Type{constructor(){super("DeviceObjType")}static get(){return r.DeviceObjType.value||=new r.DeviceObjType,r.DeviceObjType.value}str(){return"Device"}__str__(){return"Device"}}),this.registerType("torch.StreamObjType",class extends r.Type{constructor(){super("StreamObjType")}str(){return"Stream"}__str__(){return"Stream"}}),this.registerType("torch._C._GeneratorType",class extends r.Type{constructor(){super("GeneratorType")}static get(){return r._C._GeneratorType.value=r._C._GeneratorType.value||new r._C._GeneratorType,r._C._GeneratorType.value}str(){return"Generator"}__str__(){return"Generator"}}),this.registerType("torch.InterfaceType",class extends r.Type{constructor(){super("InterfaceType")}}),this.registerType("torch._C.DynamicType",class extends r.Type{constructor(){super("DynamicType")}}),this.registerType("torch._C.FunctionType",class extends r.Type{constructor(e){super("FunctionType"),this._func=e}static create(e){return new r._C.FunctionType(e)}function(){return this._func}}),this.registerType("torch._C.VarType",class extends r.Type{constructor(e){super("VarType",e)}static create(e){return new r._C.VarType(e)}name(){return this._annotation_str}hasFreeVariables(){return!0}}),this.registerType("torch._C.AliasInfo",class{constructor(){this.is_write=!1,this.before_set=[],this.after_set=[],this.containedTypes=[]}addBeforeSet(e){this.before_set.push(e)}addAfterSet(e){this.after_set.push(e)}addContainedType(e){this.containedTypes.push(e)}str(){let e=["("];return e.push(this.before_set.join("|")),this.after_set.length>0&&(e.push(" -> "),e.push(this.after_set.join("|"))),this.is_write&&e.push("!"),e.push(")"),e.join("")}}),this.registerType("torch._C.Lexer",class{constructor(e){this.buffer=e,this.position=0,this.value="",this.next()}eat(e){if(this.kind!==e)return null;let t=this.value;return this.next(),t}expect(e){if(this.kind!==e)throw new l.Error(`Unexpected '${this.kind}' instead of '${e}'.`);let t=this.value;return this.next(),t}whitespace(e){if(this.kind!==" "){if(e>this.value.length)throw new l.Error;return!1}return this.next(),!0}next(){this.position+=this.value.length;let e=this.position;if(e>=this.buffer.length)this.kind="\0",this.value="";else if(this.buffer[e]===" "){for(;this.buffer[e]===" ";)e+=1;this.kind=" ",this.value=this.buffer.slice(this.position,e)}else if(this.buffer[e]==="."&&this.buffer[e+1]==="."&&this.buffer[e+2]===".")this.kind="...",this.value="...";else if(this.buffer[e]==="["&&this.buffer[e+1]==="]")this.kind="[]",this.value="[]";else if(this.buffer[e]==="("||this.buffer[e]===")"||this.buffer[e]===":"||this.buffer[e]==="."||this.buffer[e]==="["||this.buffer[e]==="]"||this.buffer[e]===","||this.buffer[e]==="="||this.buffer[e]==="?"||this.buffer[e]==="!"||this.buffer[e]==="*"||this.buffer[e]==="|")this.kind=this.buffer[e],this.value=this.buffer[e];else if(this.buffer[e]>="a"&&this.buffer[e]<="z"||this.buffer[e]>="A"&&this.buffer[e]<="Z"||this.buffer[e]==="_"){for(e+=1;e<this.buffer.length&&(this.buffer[e]>="a"&&this.buffer[e]<="z"||this.buffer[e]>="A"&&this.buffer[e]<="Z"||this.buffer[e]>="0"&&this.buffer[e]<="9"||this.buffer[e]==="_");)e+=1;this.kind="id",this.value=this.buffer.slice(this.position,e)}else if(this.buffer[e]==="-"&&this.buffer[e+1]===">")this.kind="->",this.value="->";else if(this.buffer[e]>="0"&&this.buffer[e]<="9"||this.buffer[e]==="-"){for(e+=1;e<this.buffer.length&&(this.buffer[e]>="0"&&this.buffer[e]<="9"||this.buffer[e]==="."||this.buffer[e]==="e"||this.buffer[e]==="-");)e+=1;this.kind="#",this.value=this.buffer.slice(this.position,e)}else if(this.buffer[e]==="'"||this.buffer[e]==='"'){let t=this.buffer[e];for(e+=1;e<this.buffer.length&&this.buffer[e]!==t;)e+=this.buffer[e]==="\\"&&(this.buffer[e+1]==="'"||this.buffer[e+1]==='"'||this.buffer[e+1]==="\\")?2:1;e+=1,this.kind="string",this.value=this.buffer.slice(this.position,e)}else throw new l.Error(`Unsupported token at '${this.position}'.`)}}),this.registerType("torch._C.SchemaTypeParser",class{constructor(e,t,s){this.L=e,this.complete_tensor_types=t,this._allow_typevars=s}parseType(){let e=this.parseFakeAndRealType();return{first:e[0],second:e[2]}}parseBaseType(){let e=this.L,t=e.value;switch(e.next(),t){case"Tensor":return r.TensorType.get();case"bool":return r.BoolType.get();case"int":return r.IntType.get();case"float":return r.FloatType.get();case"complex":return r.ComplexType.get();case"str":return r.StringType.get();case"SymInt":return r.SymIntType.get();case"Scalar":return r.NumberType.get();case"ScalarType":return r.Type.get("ScalarTypeType");case"Device":return r.DeviceObjType.get();case"Layout":return r.Type.get("Layout");case"MemoryFormat":return r.Type.get("MemoryFormat");case"Generator":return r._C._GeneratorType.get();case"t":case"t1":case"t2":case"tVal":return r._C.VarType.create(t);case"Any":return r.AnyType.get();case"AnyEnumType":return r.Type.get("AnyEnumType");case"Dimname":return r.StringType.get();case"QScheme":return r.Type.get("QSchemeType");case"Stream":return r.StreamObjType.get();case"Storage":return r.Type.get("Storage");case"AnyClassType":return r.Type.get("AnyClassType");case"NoneType":return r.NoneType.get();default:throw new l.Error(`Unsupported type '${t}'.`)}}parseFakeAndRealType(){let e=this.L,t=null,s=null,i=null;if(e.eat("(")){let n=[];for(e.whitespace(0);!e.eat(")");){let a=this.parseType();n.push(a.first),i&&a.second&&i.addContainedType(a.second),e.whitespace(0),e.eat(","),e.whitespace(0)}s=r.TupleType.create(n),t=s}else if(e.value==="Future"){e.next(),e.expect("(");let a=this.parseType().first;e.expect(")"),s=r.FutureType.get(a),t=s}else if(e.value==="Await"){e.next(),e.expect("(");let a=this.parseType().first;e.expect(")"),s=r.AwaitType.get(a),t=s}else if(e.value==="RRef"){e.next(),e.expect("(");let a=this.parseType().first;e.expect(")"),s=r.RRefType.get(a),t=s}else if(e.value==="Tensor")e.next(),s=r.TensorType.get(),t=s,i=this.parseAliasAnnotation();else if(e.value==="Dict"){e.next(),e.expect("(");let n=this.parseType().first;e.expect(","),e.whitespace(0);let a=this.parseType().first;e.expect(")"),i=this.parseAliasAnnotation(),s=r.DictType.create(n,a),t=s}else if(e.eat("Union")){e.next(),e.expect("(");let n=[];for(n.push(this.parseType().first);e.cur().kind!==")";)e.expect(","),n.push(this.parseType().first);e.expect(")"),i=this.parseAliasAnnotation(),s=new r.UnionType(n),t=s}else if(e.value==="__torch__"){if(e.next(),e.expect("."),e.expect("id")!=="torch")throw new l.Error("Expected classes namespace.");if(e.expect("."),e.expect("id")!=="classes")throw new l.Error("Expected classes namespace.");e.expect(".");let o=e.expect("id");e.expect(".");let c=e.expect("id");if(s=r._C.getCustomClass(`__torch__.torch.classes.${o}.${c}`),t=s,!t)throw new l.Error(`Unknown custom class type '${o}.${c}'.`)}else s=this.parseBaseType(),t=s,(s.kind()==="ScalarTypeType"||s.kind()==="MemoryFormat"||s.kind()==="Layout"||s.kind()==="SymIntType")&&(t=r.IntType.get()),i=this.parseAliasAnnotation();for(;;)if(e.kind==="[]"){e.expect("[]"),t=r.ListType.create(t),s=r.ListType.create(s);let n=this.parseAliasAnnotation();i&&(n||(n=new r._C.AliasInfo,n.is_write=i.is_write),n.addContainedType(i)),i=n}else if(e.eat("?"))t=r.OptionalType.create(t),s=r.OptionalType.create(s);else break;return[t,s,i]}parseAliasAnnotation(){let e=this.L,t=null;if(e.eat("(")){t=new r._C.AliasInfo;do t.addBeforeSet(e.value),e.next(),e.eat("!")&&(t.is_write=!0),e.whitespace(0);while(e.eat("|"));if(e.eat("->")){e.whitespace(0);do t.addAfterSet(e.value),e.next(),e.whitespace(0);while(e.eat("|"))}e.expect(")")}return t}}),this.registerType("torch.Argument",class{constructor(...e){if(this.N=null,this.default_value=null,this.kwarg_only=!1,this.alias_info=null,e.length===2)[this.name,this.type]=e,this.real_type=this.type;else if(e.length===3&&e[1]instanceof r.Type&&e[2]instanceof r.Type)[this.name,this.type,this.real_type]=e;else if(e.length===6)[this.name,this.type,this.real_type,this.N,this.default_value,this.kwarg_only]=e;else if(e.length===7)[this.name,this.type,this.real_type,this.N,this.default_value,this.kwarg_only,this.alias_info]=e;else throw new l.Error("Invalid arguments.");let t=this.alias_info&&this.alias_info.is_write;this.is_out=this.kwarg_only&&t}has_default_value(){return this.default_value!==void 0}is_inferred_type(){return this.type instanceof r.TensorType?this.type.isInferredType():!1}static parse(e,t,s){let i=new r._C.SchemaTypeParser(e),[n,a,o]=i.parseFakeAndRealType();e.whitespace(0);let c=null;if(e.eat("[")){n=r.ListType.create(n),a=r.ListType.create(a),e.kind==="#"&&(c=Number(e.value),e.next()),e.expect("]");let _=i.parseAliasAnnotation();o&&(_||(_=new r._C.AliasInfo,_.is_write=o.is_write),_.addContainedType(o)),o=_,e.eat("?")&&(n=r.OptionalType.create(n),a=r.OptionalType.create(a))}let u=null,d;return t?(e.whitespace(0),s=!1,e.kind==="id"&&(u=e.expect("id"))):(e.whitespace(1),u=e.expect("id"),e.whitespace(0),e.eat("=")&&(e.whitespace(0),d=r.Argument._parse_value(e))),new r.Argument(u,n,a,c,d,s,o)}static _parse_value(e){let t;if(e.kind==="id")if(e.value==="True"||e.value==="False")t=e.value==="True";else if(e.value==="None")t=null;else if(e.value==="Mean"||e.value==="contiguous_format"||e.value==="long")t=e.value;else if(typeof e.value=="string")t=e.value;else if(typeof e.value=="number")t=e.value;else throw new l.Error(`Unsupported default value '${e.value}'.`);else if(e.kind==="#")t=Number(e.value);else if(e.kind==="string")t=e.value.slice(1,-1);else if(e.kind==="[]")t=[];else if(e.eat("[")){if(t=[],!e.eat("]")){for(;e.whitespace(0),t.push(r.Argument._parse_value(e)),e.whitespace(0),!!e.eat(","););e.expect("]")}return t}else throw new l.Error(`Unsupported default value '${e.kind}'.`);return e.next(),t}str(){let e=[],t=this.real_type,s=t instanceof r.OptionalType,i=s?t.getElementType():t;if(i instanceof r.ListType?(e.push(i.getElementType().str()),this.alias_info&&this.alias_info.containedTypes.length>0&&e.push(this.alias_info.containedTypes[0].str()),e.push(this.N===null?"[]":`[${this.N}]`)):e.push(i.str()),this.alias_info&&this.alias_info.before_set.length>0&&e.push(this.alias_info.str()),s&&e.push("?"),this.name&&(e.push(" "),e.push(this.name)),this.default_value!==void 0){let n=this.default_value;n===null?e.push("=None"):typeof n=="boolean"?(e.push("="),e.push(n?"True":"False")):typeof n=="string"?e.push(`="${n}"`):typeof n=="number"?(e.push(`=${n}`),Number.isInteger(n)&&this.real_type instanceof r.FloatType&&e.push(".")):Array.isArray(n)&&e.push(`=[${n.join(", ")}]`)}return e.join("")}}),this.registerType("torch._C.SchemaParser",class{constructor(e,t){this.L=new r._C.Lexer(e),this.type_parser=new r._C.SchemaTypeParser(this.L,!1,t)}parseName(){let e=this.L,t=e.expect("id").text();e.nextIf(":")&&(e.expect(":"),t=`${t}::${e.expect("ident").text()}`);let s="";return e.nextIf(".")&&(s=e.expect("ident").text()),new r._C.OperatorName(t,s)}parseDeclaration(){let e=this.L,t=this.parseName();if(e.cur().kind!=="(")return t;throw new l.Error("Not implemented.")}parseExactlyOneDeclaration(){return this.parseDeclaration()}parseArgument(){throw new l.Error("Not implemented.")}}),this.registerType("torch.FunctionSchema",class{constructor(e,t,s,i,n,a){let o=e.indexOf("(");if(o===-1)this._name=e,this._overload_name=t||"",this._arguments=s||[],this._returns=i||[],this._is_vararg=n||!1,this._is_varret=a||!1;else{let c=e.substring(0,o).trim(),u=c.indexOf(".");u===-1?(this._name=c,this._overload_name=""):(this._name=c.substring(0,u),this._overload_name=c.substring(u+1,c.length)),this._buffer=e.substring(o,e.length)}}static parse(e){return new r.FunctionSchema(e)}get name(){return this._name}get overload_name(){return this._overload_name}get arguments(){return this._parse(),this._arguments}get returns(){return this._parse(),this._returns}get is_vararg(){return this._parse(),this._is_vararg}get is_varret(){return this._parse(),this._is_varret}_parse(){if(this._buffer){let e=new r._C.Lexer(this._buffer);if(this._arguments=[],this._is_vararg=!1,this._kwarg_only=!1,e.expect("("),!e.eat(")")){for(;;){if(e.whitespace(0),this._is_vararg)throw new l.Error;if(e.eat("*"))this._kwarg_only=!0;else if(e.eat("..."))this._is_vararg=!0;else{let t=r.Argument.parse(e,!1,this._kwarg_only);this._arguments.push(t)}if(e.whitespace(0),!e.eat(","))break}e.expect(")")}if(e.whitespace(0),e.expect("->"),e.whitespace(0),this._returns=[],this._is_varret=!1,e.eat("..."))this._is_varret=!0;else if(e.eat("(")){if(e.whitespace(0),!e.eat(")")){for(;;){if(e.whitespace(0),this._is_varret)throw new l.Error;if(e.eat("..."))this._is_varret=!0;else{let t=r.Argument.parse(e,!0,!1);this._returns.push(t)}if(e.whitespace(0),!e.eat(","))break}e.expect(")")}e.whitespace(0)}else this._returns.push(r.Argument.parse(e,!0,!1));delete this._buffer}}__str__(){let e=[this.name],t=this.overload_name;t!==""&&t!=="default"&&e.push(`.${this.overload_name}`),e.push("(");let s=!0,i=!1;for(let o of this.arguments)s||e.push(", "),o.kwarg_only&&!i&&(e.push("*, "),i=!0),s=!1,e.push(o.str());this.is_vararg&&(s||e.push(", "),s=!0,e.push("...")),e.push(") -> ");let n=this.returns,a=!this.is_varret&&(n.length!==1||n[0].name||n[0].real_type instanceof r.TupleType||n[0].real_type instanceof r.ListType&&n[0].real_type.getElementType()instanceof r.TupleType);a&&e.push("("),s=!0;for(let o of this.returns)s||e.push(", "),s=!1,e.push(o.str());return this.is_varret&&(s||e.push(", "),s=!0,e.push("...")),a&&e.push(")"),e.join("")}aliasAnalysis(){return this._alias_kind||"CONSERVATIVE"}setAliasAnalysis(e){this._alias_kind=e}hasAnyAliasInfo(){for(let e of this.arguments)if(e.alias_info!==null)return!0;for(let e of this.returns)if(e.alias_info!==null)return!0;return!1}is_mutable(){return this.arguments.some(e=>{let t=e.alias_info;return t&&t.is_write})}}),this.registerType("torch._C.SchemaInfo",class{constructor(e){this._schema=e,this._alias_maps_current=!1,this._has_init=!1}is_nondeterministic(){return this._schema.name==="aten::dropout"&&this._schema.overload,r._C.nondeterministic_op_strings=r._C.nondeterministic_op_strings||new Set(["aten::dropout(Tensor input, float p, bool train) -> Tensor","aten::_fused_dropout(Tensor self, float p, Generator? generator) -> (Tensor, Tensor)","aten::_standard_gamma(Tensor self, Generator? generator) -> Tensor","aten::bernoulli(Tensor self, *, Generator? generator) -> Tensor","aten::bernoulli(Tensor self, float p, *, Generator? generator) -> Tensor","aten::multinomial(Tensor self, int num_samples, bool replacement, *, Generator? generator) -> Tensor","aten::native_dropout(Tensor input, float p, bool? train) -> (Tensor, Tensor)","aten::normal(Tensor mean, Tensor std, *, Generator? generator) -> Tensor","aten::normal(float mean, Tensor std, *, Generator? generator) -> Tensor","aten::normal(Tensor mean, float std, *, Generator? generator) -> Tensor","aten::poisson(Tensor self, Generator? generator) -> Tensor","aten::binomial(Tensor count, Tensor prob, Generator? generator=None) -> Tensor","aten::rrelu(Tensor self, Scalar lower, Scalar upper, bool training, Generator? generator) -> Tensor","aten::rrelu_with_noise(Tensor self, Tensor noise, Scalar lower, Scalar upper, bool training, Generator? generator) -> Tensor","aten::rand(int[] size, *, int? dtype, int? layout, Device? device, bool? pin_memory) -> Tensor","aten::rand_like(Tensor self, *, int? dtype=None, int? layout=None, Device? device=None, bool? pin_memory=None, MemoryFormat? memory_format=None) -> Tensor","aten::randint(int high, int[] size, *, int? dtype, int? layout, Device? device, bool? pin_memory) -> Tensor","aten::randint(int low, int high, int[] size, *, int? dtype, int? layout, Device? device, bool? pin_memory) -> Tensor","aten::randint_like(Tensor self, int high, *, int? dtype=None, int? layout=None, Device? device=None, bool? pin_memory=None, MemoryFormat? memory_format=None) -> Tensor","aten::randint_like(Tensor self, int low, int high, *, int? dtype=None, int? layout=None, Device? device=None, bool? pin_memory=None, MemoryFormat? memory_format=None) -> Tensor","aten::randn(int[] size, *, int? dtype, int? layout, Device? device, bool? pin_memory) -> Tensor","aten::randn_like(Tensor self, *, int? dtype=None, int? layout=None, Device? device=None, bool? pin_memory=None, MemoryFormat? memory_format=None) -> Tensor","aten::randperm(int n, *, int? dtype, int? layout, Device? device, bool? pin_memory) -> Tensor"]),!!r._C.nondeterministic_op_strings.has(this._schema.__str__())}}),this.registerFunction("torch._C.builtin_cast_method_to_scalar_type",()=>new Map),this.registerFunction("torch._C.string_to_type_lut",()=>{if(!r._C.string_to_type_lut.basePythonTypes){let e=new Map;e.set("Tensor",r.TensorType.get()),e.set("int",r.IntType.get()),e.set("float",r.FloatType.get()),e.set("bool",r.BoolType.get()),e.set("complex",r.ComplexType.get()),e.set("str",r.StringType.get()),e.set("Device",r.DeviceObjType.get()),e.set("number",r.NumberType.get()),e.set("None",r.NoneType.get()),e.set("NoneType",r.NoneType.get()),e.set("Any",r.AnyType.get()),e.set("list",r.Type.get("AnyListType")),e.set("tuple",r.Type.get("AnyTupleType")),r._C.string_to_type_lut.basePythonTypes=e}return r._C.string_to_type_lut.basePythonTypes}),this.registerType("torch._C.ScriptTypeParser",class{constructor(e){this._resolver=e}parseSchemaFromDef(e,t){let s=e.name,i=this.parseArgsFromDecl(e,t),n=this.parseReturnFromDecl(e);return new r.FunctionSchema(s,"",i,n,!1,!1)}parseArgsFromDecl(e,t){let s=[];if(e.args.posonlyargs.length>0||e.args.kwonlyargs.length>0)throw new l.Error("Unsupported function argument.");let i=e.args.args.slice(),n=new Set(Array.from(e.args.kwonlyargs)),a=t?1:0;for(let o=a;o<i.length;o++){let c=i[o],u=null,d=void 0,_=c.annotation?this.parseTypeFromExpr(c.annotation):null,f=new r.Argument(c.arg,_,_,u,d,n.has(c),null);s.push(f)}return s}parseReturnFromDecl(e){if(!e.returns)return[];if(this.parseBroadcastList(e.returns))throw new l.Error("Broadcastable lists cannot appear as a return type.");let t=this.parseTypeFromExpr(e.returns);return[new r.Argument("",t,t,null,void 0,!1)]}parseTypeFromExpr(e){if(this._resolver&&e instanceof h.Name){let t=this._resolver.resolveType(e.id);if(t)return t}return this.parseTypeFromExprImpl(e)}parseTypeFromExprImpl(e){if(e instanceof h.Subscript){let s=this.parseBaseTypeName(e.value);if(!s)throw new l.Error("Subscripted type must be a type identifier.");return this.subscriptToType(s,e)}let t=this.parseBaseTypeName(e);if(t){let s=r._C.string_to_type_lut().get(t);if(s)return s;if(this._resolver){let i=this._resolver.resolveType(t,e);if(i)return i}}throw new l.Error(`Unknown type name '${t}'.`)}parseBaseTypeName(e){if(e instanceof h.Name)return e.id;if(e instanceof h.Constant&&e.value===null)return"None";if(e instanceof h.Attribute){let t=e.attr,s=new Set(["Tensor","LongTensor","FloatTensor","DoubleTensor","IntTensor","ShortTensor","HalfTensor","CharTensor","ByteTensor","BoolTensor"]);return r._C.isTorch(e.value)&&s.has(t)?t:r._C.collectQualname(e)}throw new l.Error(`Unsupported type '${e.__class__.__name__}'.`)}parseBroadcastList(){return null}parseType(e){let t=h.parse(e);return this.parseTypeFromExpr(t.body[0].value)}subscriptToType(e,t){if(e==="Tuple"||e==="tuple"){let s=[],i=t.slice instanceof h.Tuple?t.slice.elts:[t.slice];for(let n of i)s.push(this.parseTypeFromExprImpl(n));return r.TupleType.create(s)}else if(e==="List"||e==="list"){if(t.slice instanceof h.Slice||t.slice instanceof h.Tuple)throw new l.Error("List type must have exactly one element type.");let s=this.parseTypeFromExprImpl(t.slice);return r.ListType.create(s)}else if(e==="Optional"){if(t.slice instanceof h.Slice||t.slice instanceof h.Tuple)throw new l.Error("Optional type must have exactly one element type.");let s=this.parseTypeFromExprImpl(t.slice);return r.OptionalType.create(s)}else if(e==="Union"){let s=[];for(let i of t.slice.elts)s.push(this.parseTypeFromExprImpl(i));return r.UnionType.create(s)}else if(e==="Future"||e==="torch.jit.Future"){if(t.slice.elts.length!==1)throw new l.Error("Future type must have exactly one element type.");let s=this.parseTypeFromExprImpl(t.slice.elts[0]);return r.FutureType.create(s)}else if(e==="Await"||e==="torch.jit._Await"){if(t.slice.elts.length!==1)throw new l.Error("Await type must have exactly one element type.");let s=this.parseTypeFromExprImpl(t.slice.elts[0]);return r.AwaitType.create(s)}else if(e==="RRef"){if(t.slice.elts.length!==1)throw new l.Error("RRef type must have exactly one element type.");let s=this.parseTypeFromExprImpl(t.slice.elts[0]);return r.RRefType.create(s)}else if(e==="Dict"||e==="dict"){if(t.slice.elts.length!==2)throw new l.Error("Dict type must have exactly two element types.");let s=this.parseTypeFromExprImpl(t.slice.elts[0]),i=this.parseTypeFromExprImpl(t.slice.elts[1]);return r.DictType.create(s,i)}throw new l.Error(`Unknown type constructor '${e}'.`)}}),this.registerFunction("torch._C.isTorch",e=>e instanceof h.Name&&e.id==="torch"),this.registerFunction("torch._C.collectQualname",e=>{let t=e.value;return t instanceof h.Name?`${t.id}.${e.attr}`:`${r._C.collectQualname(t)}.${e.attr}`}),this.registerType("torch._ops.OpOverload",class extends r._ops.OperatorBase{constructor(e,t,s,i,n){super(),this._op=t,this._op_dk=s,this._schema=i,this._overloadpacket=e,this._tags=n,this._overloadname=i.overload_name===""?"default":i.overload_name,this._name=this._schema.name,this._name=i.overload_name?`${this._name}.${i.overload_name}`:this._name,this.__name__=`${this._schema.name.split("::")[1]}.${this._overloadname}`,this.__module__=e.__module__,t.__module__=e.__module__,this.__qualname__=m._name,this.__annotations__={};let a=null;for(let o of this._schema.arguments)o.alias_info&&(a=a===null?o.alias_info.is_write:o.alias_info.is_write||a);this.is_view=a!==null&&!a}get name(){return this._name}}),this.registerType("torch._ops.OpOverloadPacket",class{constructor(e,t,s,i){this._qualified_op_name=e,this.__name__=t,this._op=s,this._overload_names=i,this._dir=[],this._has_torchbind_op_overload=this._schemas.some(n=>this._has_script_object_arg(n))}get _schemas(){return this._overload_names.map(e=>r._C._get_schema(this._qualified_op_name,e))}__getattr__(e){e=e==="default"?"":e;let t=r._C._get_operation_overload(this._qualified_op_name,e),[s,i,n]=t,a=r._C._get_schema(this._qualified_op_name,e),o=this._has_script_object_arg(a)?new r._ops.TorchBindOpOverload(this,s,i,a,n):new r._ops.OpOverload(this,s,i,a,n);return T.setattr(m,e,o),this._dir.push(e),o}_has_script_object_arg(e){return e.arguments.some(t=>t.type instanceof r.ClassType)}}),this.registerType("torch._ops._OpNamespace",class extends V.ModuleType{constructor(e){super(`torch.ops.${e}`),this.name=e,this._dir=[]}__getattr__(e){let t=this.name,s=`${t}::${e}`,i=`${this.__module__}.${t}`,n=null,a=null;try{[n,a]=this._get_packet(s,i)}catch{}if(!n)throw new l.Error(`Unknown operator type '${s}'.`);n.__module__=i;let o=new r._ops.OpOverloadPacket(s,e,n,a);return o.__module__=`${this.__module__}.${t}`,T.setattr(this,e,o),this._dir.push(e),o}_get_packet(e,t){let[s,i]=r._C._jit_get_operation(e);return s.__module__=t,[s,i]}}),this.registerType("torch._C.graph_node_list",class{constructor(e){this.head=e}front(){return this.head.next}end(){return this.head.prev}[Symbol.iterator](){let e=this.head.next,t=this.head.prev;return{next(){if(e!==t){let s=e;return e=e.next,{value:s,done:!1}}return{done:!0}}}}}),this.registerType("torch.Graph",class{constructor(){this._next_unique=0,this._unique_names=new Map,this._name_base_suffix=new Map,this.all_nodes=new Set,this.all_values=new Set,this.all_blocks=new Set,this._block=new r.Block(this,null),this._insert_before=this.return_node()}insert(e,t,s,i){return r._C.emitBuiltinCall(i,this,e,t,s)}create(e,...t){let s=null,i=1;t.length===2&&Array.isArray(t[0])&&typeof t[1]=="number"?[s,i]=t:t.length===1&&(typeof t[0]=="number"?[i]=t:Array.isArray(t[0])&&([s]=t));let n=new r.Node(this,e);if(s)for(let a of s)n.addInput(a);for(let a=0;a<i;a++)n.addOutput();return n}createClone(e,t,s){s=s===void 0?!0:s;let i=e.allocNewInstance(this);for(let n of e.outputs())i.addOutput().copyMetadata(n);i.cloneFrom(e);for(let n of e.inputs())i.addInput(t(n));if(s)for(let n of e.blocks())i.addBlock().cloneFrom(n,t);return i}createNone(){let e=this.create("prim::Constant");return e.output().setType(r.NoneType.get()),e}createUninitialized(e){let t=this.create("prim::Uninitialized");return t.output().setType(e),t}createEnumValue(e){let t=e.type().expect(r.EnumType),s=this.create("prim::EnumValue",[e]);return s.output().setType(t.getValueType()),s}createList(e,t){let s=this.create("prim::ListConstruct",t);for(let i of t)if(!i.type().isSubtypeOf(e))throw new l.Error("Invalid list item.");return s.output().setType(r.ListType.create(e)),s}createListUnpack(e,t){let i=e.type().expect(r.ListType).getElementType(),n=this.create("prim::ListUnpack",[e],0);for(let a=0;a<t;a++)n.addOutput().setType(i);return n}createTuple(e,t){if(!t){let i=e.map(n=>n.type());t=r.TupleType.create(i)}let s=this.create("prim::TupleConstruct",e);return s.output().setType(t),s}createTupleUnpack(e){let t=e.type().expect(r.TupleType),s=this.create("prim::TupleUnpack",[e],0);for(let i of t.elements())s.addOutput().setType(i);return s}createTupleIndex(e,t,s){let i=this.create("prim::TupleIndex",[e,t]);return i.output().setType(s),i}createTupleSlice(e,t,s,i){let n=[],a=e.type().expect(r.TupleType),o=t;for(let u=0;u<i;u++){let d=this.insertConstant(new r._C.IValue(o,"Int")),_=this.insertNode(this.createTupleIndex(e,d,a.elements()[o]));n.push(_.output()),o+=s}return this.createTuple(n)}createDict(e,t,s,i){if(s.length!==i.length)throw new l.Error("Invalid dictionary size.");let n=this.create("prim::DictConstruct"),a=s.length;for(let o=0;o<a;o++){if(!s[o].type().isSubtypeOf(e))throw new l.Error("Invalid key.");if(!i[o].type().isSubtypeOf(t))throw new l.Error("Invalid value.");n.addInput(s[o]),n.addInput(i[o])}return n.output().setType(r.DictType.create(e,t)),n}createObject(e){let t=this.create("prim::CreateObject");return t.output().setType(e),t}createIsInstance(e,t){let s=this.create("prim::isinstance",[e],1);return s.tys_("types",t),s.output().setType(r.BoolType.get()),s}createSetAttr(e,t,s){let i=this.create("prim::SetAttr",[e,s],0);return i.s_("name",t),i}createGetAttr(e,t){let s=this.create("prim::GetAttr",[e]);s.s_("name",t);let n=e.type().getAttribute(t);return s.output().setType(n),s.output().setDebugName(r._C.normalizeAttrName(t)),s}createLoad(e,t){let s=this.create("prim::Load",[],1);return s.s_("name",e),s.output().setType(t),s}createStore(e,t){let s=this.create("prim::Store",[t],0);return s.s_("name",e),s}inputs(){return this._block.inputs()}outputs(){return this._block.outputs()}nodes(){return this._block.nodes()}param_node(){return this._block.param_node()}return_node(){return this._block.return_node()}block(){return this._block}addInput(e){return this._block.addInput(e)}insertNode(e){return r._C.AT_ASSERT(this._insert_before.inBlockList()),e.insertBefore(this._insert_before)}insertConstant(e,t,s){return r._C.insertConstant(this,e,t,s)}insertMethodCall(e,t){return this.insertNode(this.create("prim::CallMethod",t.inputs)).s_("name",e).output().setType(t.return_types[0])}insertUncheckedCast(e,t){let s=this.create("prim::unchecked_cast",[e]);return this.insertNode(s),s.output().setType(t),s.output()}insertToList(e,t){let s=0,i=t;for(;i instanceof r.ListType;)i=i.getElementType(),s+=1;let n=0;if(i instanceof r.IntType)n=0;else if(i instanceof r.FloatType)n=1;else if(i instanceof r.BoolType)n=2;else if(i instanceof r.ComplexType)n=3;else throw new l.Error(`Unsupported list type '${t.kind()}'.`);let a=this.insertConstant(s),o=this.insertConstant(n),c=this.insertNode(this.create("prim::tolist",[e,a,o]));return c.output().setType(t),c.output()}insertFunctionCall(e,t){let s=e.name(),n=[this.insertNode(this.create("prim::Constant")).s_("name",s).output().setType(r._C.FunctionType.create(e)),...t.inputs];return this.insertNode(this.create("prim::CallFunction",n)).output().setType(t.return_types[0])}insertPoint(){return this._insert_before}setInsertPoint(e){e instanceof r.Block&&(e=e.return_node()),this._insert_before=e}freeNode(e){this.all_nodes.delete(e)}freeValue(e){e.setDebugName(""),this.all_values.delete(e)}freeBlock(e){this.all_blocks.delete(e)}copy(){let e=new r.Graph;return e.cloneFrom(this),e}cloneFrom(e){let t=s=>{throw new l.Error(`Use of value '${s.debugName()}' not in scope.`)};this.block().cloneFrom(e.block(),t)}set_op_version(e){this._op_version=e}get_op_version(){return this._op_version}print(e,t){e.write("graph("),r._C.const_value_list_with_types(e,this.inputs(),`,
|
|
29
|
+
`),e.write(`):
|
|
30
|
+
`);let s=[];for(let i of this.nodes())i.print(e,1,s,t);e.write(" return ("),r._C.printValueRefs(e,this.outputs()),e.write(`)
|
|
31
|
+
`);for(let i=0;i<s.length;i++){let n=s[i];e.write("with "),e.write(n.kind()),e.write(`_${i} = `),e.write(n.g("Subgraph"))}return e}toString(){let e=new J.StringIO;return this.print(e,!0),e.toString()}}),this.registerType("torch.Block",class{constructor(e,t){this._graph=e,this._input=e.create("prim::Param",0),this._output=e.create("prim::Return",0),this._owning_node=t,this._input.next=this._output,this._input.prev=this._output,this._output.next=this._input,this._output.prev=this._input,this._graph.all_blocks.add(this),this._output._owning_block=this,this._input._owning_block=this}inputs(){return this._input.outputs()}outputs(){return this._output.inputs()}nodes(){return new r._C.graph_node_list(this._input)}return_node(){return this._output}param_node(){return this._input}owningNode(){return this._owning_node}owningGraph(){return this._graph}addInput(e){let t=this._input.addOutput();return t.setDebugName(e||""),t}registerOutput(e){return this._output.addInput(e),this.outputs().length-1}appendNode(e){if(e._graph!==this._graph||e.inBlockList())throw new l.Error("Node not in graph.");return e.insertBefore(this._output),e}cloneFrom(e,t){let s=new Map,i=a=>s.has(a)?s.get(a):t(a),n=this.owningGraph();for(let a of e.inputs())s.set(a,this.addInput().copyMetadata(a));for(let a of e.nodes()){let o=this.appendNode(n.createClone(a,i));for(let c=0;c<a.outputs().length;c++){let u=a.outputs()[c],d=o.outputs()[c];s.set(u,d),d.copyMetadata(u)}}for(let a of e.outputs())this.registerOutput(i(a))}eraseOutput(e){this._output.removeInput(e)}destroy(){this._output.removeAllInputs();for(let e of this.nodes())e.destroy();this._output.destroy(),this._input.destroy(),this._graph.freeBlock(this)}}),this.registerType("torch.Node",class{constructor(e,t){this._kind=t,this._graph=e,this._owning_block=null,this._values=new Map,this._inputs=[],this._outputs=[],this._blocks=[],this._graph.all_nodes.add(this),this._prev=null,this._next=null,this._source_range=null,this._op=null}owningGraph(){return this._graph}owningBlock(){return this._owning_block}kind(){return this._kind}schema(){if(this._op)return this._op.schema();let e=this.maybeOperator();return e?e.schema():null}hasNamedInput(e){for(let t of this.schema().arguments)if(t.name===e)return!0;return!1}matches(e){if(r._C.isBlockListedSchema(e)||this.kind()!==e.name)return!1;let t=this.inputs(),s=e.arguments;if(t.length<s.length)return!1;let i=new Map;for(let n=0;n<s.length;n++){let a=s[n].type;if(!r._C.matchTypeVariables(a,t[n].type(),i).success())return!1;let c=r._C.tryEvalTypeVariables(a,i);if(c&&(a=c),!t[n].type().isSubtypeOf(a))return!1}return!(!e.is_vararg&&t.length!==s.length)}mustBeNone(){return this._kind==="prim::AutogradZero"||this.outputs().length===1&&this.output().type()===r.NoneType.get()||this._kind==="prim::Constant"&&!this.hasAttributes()&&this.output().type()instanceof r.OptionalType}maybeSchema(){let e=this.maybeOperator();return e?e.schema():null}maybeOperator(){if(!this._op){let e=r._C.getAllOperatorsFor(this.kind());for(let t of e)if(this.matches(t.schema())){this._op=t;break}}return this._op}getOperator(){let e=this.maybeOperator();if(e)return e;throw new l.Error(`Schema not found for node '${this.kind()}'.`)}getOperation(){return this.getOperator().getOperation(this)}isNondeterministic(){let e=this.maybeSchema();if(!this.kind().startsWith("aten::")||!e)return!1;let t=new r._C.SchemaInfo(e);if(this.hasNamedInput("train"))throw new l.Error("Not Implemented.");return t.is_nondeterministic()}hasSideEffects(){switch(this._kind){case"prim::PythonOp":case"prim::IgnoredPythonOp":case"prim::Print":case"prim::RaiseException":case"aten::warn":case"aten::save":case"aten::manual_seed":case"prim::AddStatValue":case"prim::TimePoint":case"prim::CallFunction":case"prim::CallMethod":case"prim::BailoutTemplate":case"prim::BailOut":case"prim::rpc_async":case"prim::rpc_sync":case"prim::rpc_remote":case"aten::wait":case"cuda::set_stream":case"cuda::_set_device":case"cuda::_current_device":case"cuda::synchronize":case"prim::Enter":case"prim::Exit":return!0;default:break}let e=this.maybeOperator();if(!e)return r._C.TORCH_INTERNAL_ASSERT(this._kind.startsWith("prim::")),!1;switch((this._kind.startsWith("prim::")||this._kind.startsWith("aten::")||this._kind.startsWith("cuda::"))&&r._C.TORCH_INTERNAL_ASSERT(e.aliasAnalysisKind()==="INTERNAL_SPECIAL_CASE"||e.aliasAnalysisKind()==="FROM_SCHEMA"||e.aliasAnalysisKind()==="CONSERVATIVE"),e.aliasAnalysisKind()){case"PURE_FUNCTION":case"FROM_SCHEMA":case"INTERNAL_SPECIAL_CASE":return!1;case"CONSERVATIVE":return!0;default:break}return r._C.TORCH_INTERNAL_ASSERT(!1),!1}inputs(){return this._inputs}outputs(){return this._outputs}input(e){return e===void 0?(r._C.AT_ASSERT(this._inputs.length===1),this._inputs[0]):this._inputs[e]}output(e){return e===void 0?(r._C.AT_ASSERT(this._outputs.length===1),this._outputs[0]):this._outputs[e]}hasUses(){for(let e of this.outputs())if(e.uses().length>0)return!0;return!1}blocks(){return this._blocks}insertInput(e,t){r._C.AT_ASSERT(this._graph===t.owningGraph()),this._op=null;for(let s=e;s<this._inputs.length;s++){let i=this.findUseForInput(s);i.offset+=1}return this._inputs.splice(e,0,t),t._uses.push(new r.Use(this,e)),t}addInput(e){r._C.AT_ASSERT(this._graph===e.owningGraph()),this._op=null;let t=new r.Use(this,this._inputs.length);return e.uses().push(t),this._inputs.push(e),e}addOutput(){let e=new r.Value(this,this._outputs.length);return this._outputs.push(e),e}addBlock(){return this._op=null,this._blocks.push(new r.Block(this.owningGraph(),this)),this._blocks[this._blocks.length-1]}get prev(){return this._prev}set prev(e){this._prev=e}get next(){return this._next}set next(e){this._next=e}insertBefore(e){if(!e.inBlockList())throw new l.Error("Node not in block.");return this.insertAfter(e.prev),this}insertAfter(e){r._C.AT_ASSERT(!this.inBlockList()||e.inBlockList()),r._C.AT_ASSERT(e.owningBlock()),r._C.TORCH_INTERNAL_ASSERT(e.kind()!=="prim::Return"),this._owning_block=e.owningBlock();let t=e.next;return e.next=this,this.prev=e,this.next=t,t.prev=this,this}allocNewInstance(e){return new r.Node(e,this.kind())}cloneFrom(e){this._source_range=e._source_range,e._scope&&!e._scope.isBlank()&&(this._scope=e._scope),this.copyAttributes(e),this._callstack=e._callstack}copyAttributes(e){return this._values=new Map(e._values),this}dropInput(e){r._C.AT_ASSERT(e<this._inputs.length);let t=this._inputs[e],s=this.findUseForInput(e);return t._uses=t._uses.filter(i=>i!==s),this._inputs[e]=null,t}eraseOutput(e){r._C.AT_ASSERT(e<this._outputs.length),this._op=null;let t=this._outputs[e];this._outputs.splice(e,1),this.owningGraph().freeValue(t);for(let s=e;s<this._outputs.length;s++)this._outputs[s]._offset--}eraseBlock(e){this._op=null;let t=this._blocks[e];this._blocks.splice(e,1),t.destroy()}findUseForInput(e){let t=this._inputs[e]._uses;for(let s of t)if(s.user===this&&s.offset===e)return s;throw new l.Error("Input use not found.")}moveBefore(e){this.removeFromList(),this.insertBefore(e)}removeInput(e){this._op=null,this.dropInput(e);for(let t=e+1;t<this._inputs.length;t++){let s=this.findUseForInput(t);s.offset--}this._inputs.splice(e,1)}removeAllInputs(){this._op=null;for(let e=0;e<this._inputs.length;e++)this.dropInput(e);this._inputs=[]}inBlockList(){return this.next!==null}removeFromList(){this._owning_block=null;let e=this.next,t=this.prev;t.next=e,e.prev=t,this.next=null,this.prev=null}destroy(){for(;this.outputs().length>0;)this.eraseOutput(this.outputs().length-1);for(;this.blocks().length>0;)this.eraseBlock(this.blocks().length-1);this.removeAllInputs(),this.inBlockList()&&this.removeFromList(),this._graph.freeNode(this)}replaceAllUsesWith(e){r._C.AT_ASSERT(this.outputs().length===e.outputs().length);let t=this.outputs().length;for(let s=0;s<t;s++)this.outputs()[s].replaceAllUsesWith(e.outputs()[s])}s_(e,t){return this._values.set(e,[t,"s"]),this}s(e){return this._values.get(e)[0]}ss_(e,t){return this._values.set(e,[t,"ss"]),this}ss(e){return this._values.get(e)[0]}i_(e,t){return this._values.set(e,[t,"i"]),this}i(e){return this._values.get(e)[0]}f_(e,t){return this._values.set(e,[t,"f"]),this}f(e){return this._values.get(e)[0]}t_(e,t){return this._values.set(e,[t,"t"]),this}t(e){return this._values.get(e)[0]}tys_(e,t){return this._values.set(e,[t,"tys"]),this}tys(e){return this._values.get(e)[0]}ival_(e,t){return this._values.set(e,[t,"ival"]),this}ival(e){return this._values.get(e)[0]}hasAttribute(e){return this._values.has(e)}hasAttributes(){return this._values.size>0}attributeNames(){return Array.from(this._values.keys())}kindOf(e){return this._values.get(e)[1]}setSourceRange(e){return r._C.AT_ASSERT(e instanceof r._C.SourceRange),this._source_range=e,this}sourceRange(){return this._source_range?this._source_range:new r._C.SourceRange}print_attributes(e,t){t=t||!1,e.write("[");let s=this.attributeNames();for(let i=0;i<s.length;i++){let n=s[i];t&&n==="Subgraph"||(i>0&&e.write(", "),e.write(`${n}=`),this.printAttrValue(e,n))}e.write("]")}printTypeList(e,t){e.write("[");for(let s=0;s<t.length;s++){let i=t[s];s++>0&&e.write(", "),e.write(i.str())}e.write("]")}printAttrValue(e,t){let s=this.kindOf(t);switch(s){case"c":case"cs":case"f":case"fs":case"i":case"is":case"ss":case"ival":case"ty":e.write(this[s](t));break;case"s":e.write(`"${this.s(t)}"`);break;case"t":e.write('"{}"');break;case"ts":e.write("[<Tensors>]");break;case"g":e.write("[<Graph>]");break;case"gs":e.write("[<Graphs>]");break;case"tys":this.printTypeList(e,this.tys(t));break;default:throw new l.Error(`Unknown attribute kind '${s}'.`)}}print(e,t,s,i,n,a,o){i=i!==!1,n=n!==!1,a=a!==!1,o=o!==!1;let c=this.outputs();if(r._C.indent(e,t),r._C.const_value_list_with_types(e,c,", "),e.write(" = "),this.kind()==="prim::PythonOp")throw new l.Error("Not implemented.");if(this.hasAttribute("Subgraph")&&s)throw new l.Error("Not implemented.");if(e.write(this.kind()),n&&this.hasAttributes()&&this.print_attributes(e),e.write("("),r._C.printValueRefs(e,this.inputs()),e.write(")"),i){let u=this.sourceRange();if(u.source()){let _=this.sourceRange().source().findSourceRangeThatGenerated(u);_&&(u=_)}let d=u.file_line_col();if(d!==null){let[_,f,g]=d;e.write(` # ${_}:${f}:${g}`)}}if(!o)return e;e.write(`
|
|
32
|
+
`);for(let u=0;u<this.blocks().length;u++){let d=this.blocks()[u];r._C.indent(e,t+1),e.write(`block${u}(`),r._C.const_value_list_with_types(e,d.inputs()),e.write(`):
|
|
33
|
+
`);for(let _ of d.nodes())_.print(e,t+2,s);r._C.indent(e,t+2),e.write("-> ("),r._C.printValueRefs(e,d.outputs()),e.write(`)
|
|
34
|
+
`)}return e}toString(){let e=new J.StringIO;return this.print(e,0,!0),e.toString()}}),this.registerType("torch.Value",class{constructor(e,t){this._node=e,this._offset=t,this._unique=e._graph._next_unique++,this._uses=[],this._node._graph.all_values.add(this)}unique(){return this._unique}node(){return this._node}owningGraph(){return this._node.owningGraph()}uses(){return this._uses}hasUses(){return this._uses.length>0}mustBeNone(){return this.type()instanceof r.NoneType||this._node.mustBeNone()}mustNotBeNone(){return this._node.kind()!=="prim::AutogradAdd"&&this.type()!==r.NoneType.get()&&!(this.type()instanceof r.OptionalType)&&!(this.type()instanceof r.UnionType&&this.type().expect(r.UnionType).canHoldType(r.NoneType.get()))}isValidName(e){return e.length===0?!0:!r._C.isNumber(e)}hasDebugName(){return this._unique_name&&this._unique_name.length>0}setDebugName(e){if(!this.isValidName(e))throw new l.Error(`Invalid name '${e}'.`);let t=this.node().owningGraph()._unique_names;if(this.hasDebugName()&&(t.delete(this._unique_name),this._unique_name=""),!e)return this;let s=t.get(e);if(s){let i=1,n=e,a=e.lastIndexOf(".");a!==-1&&/^\d+$/.test(e.substring(a+1))&&(i=Number(e.substring(a+1)),n=e.substring(0,a));let o=this.node().owningGraph()._name_base_suffix;o.has(n)&&(i=Math.max(i,o.get(n)));let c=null;do c=`${n}.${i++}`;while(t.has(c));o.set(n,i),s.setDebugName(c)}return t.set(e,this),this._unique_name=e,this}debugName(){return this.hasDebugName()?this._unique_name:this.unique().toString()}type(){return this._type}setType(e){e instanceof r._C.DynamicType&&(e=e.fallback()),this._type=e;for(let t of this._uses)t.user._op=null;return this}set value(e){if(e instanceof r.Value)throw new l.Error("Value cannot be a value.");this._value=e}get value(){return this._value}replaceFirstUseWith(e){r._C.AT_ASSERT(this.owningGraph()===e.owningGraph());let[t]=this.uses();t.user._inputs[t.offset]=e,e._uses.push(t),this._uses.shift()}replaceAllUsesWith(e){for(;this.uses().length>0;)this.replaceFirstUseWith(e)}copyMetadata(e){return this.setType(e.type()),e.hasDebugName()&&this.setDebugName(e.debugName()),this}toString(){return`${this.debugName()} : ${this.type().toString()}`}}),this.registerType("torch.Use",class{constructor(e,t){this.user=e,this.offset=t}}),this.registerType("torch._C.IValue",class{constructor(e,t){if(this.value=e,t)this.tag=t;else if(e===void 0)this.tag="None",this.value="None";else if(typeof e=="boolean")this.tag="Bool";else if(typeof e=="string")this.tag="String";else if(e instanceof r.Tensor)this.tag="Tensor";else if(e instanceof r.ScriptObject)this.tag="Object";else if(Array.isArray(e))this.tag="GenericList";else if(e instanceof r._C.Tuple)this.tag="Tuple";else if(e instanceof r.device)this.tag="Device";else if(Number.isInteger(e))this.tag="Int";else if(typeof e=="number")this.tag="Double";else if(e instanceof r._C.EnumHolder)this.tag="Enum";else throw new l.Error("Unsupported type.")}isNone(){return this.tag==="None"}isBool(){return this.tag==="Bool"}toBool(){return this.value}isObject(){return this.tag==="Object"}toObject(){return this.value}isTensor(){return this.tag==="Tensor"}toTensor(){return this.value}isDouble(){return this.tag==="Double"}toDouble(){return this.value}isComplexDouble(){return this.tag==="ComplexDouble"}isInt(){return this.tag==="Int"}toInt(){if(this.isInt())return this.value;if(this.isSymInt())return this.toSymInt().guard_int();throw new l.Error("Expected int.")}isString(){return this.tag==="String"}toStringRef(){return this.value}isList(){return this.tag==="GenericList"}toList(){return this.value}isDevice(){return this.tag==="Device"}toDevice(){return this.value}isGenerator(){return this.tag==="Generator"}isStream(){return this.tag==="Stream"}isGenericDict(){return this.tag==="GenericDict"}isEnum(){return this.tag==="Enum"}toEnumHolder(){return this.value}isTuple(){return this.tag==="Tuple"}toTupleRef(){return this.value}isCustomClass(){return r._C.isCustomClass(this)}equals(e){switch(this.tag){case"None":return e.isNone();case"Bool":return e.isBool()&&this.toBool()===e.toBool();case"Int":return e.isInt()&&this.toInt()===e.toInt();case"Double":return e.isDouble()&&this.toDouble()===e.toDouble();case"String":return e.isString()&&this.toString()===e.toString();case"Tensor":return e.isTensor()&&this.toTensor()===e.toTensor();case"Object":return e.isObject()&&this.toObject()===e.toObject();case"Device":return e.isObject()&&this.toDevice()===e.toDevice();case"GenericList":{if(e.isList()){let t=this.toList(),s=e.toList();return t.length===s.length&&t.every((i,n)=>i===s[n])}return!1}default:throw new l.Error(`IValue.equals() not implemented for '${this.tag}.`)}}is(e){return this.equals(e)}type(){switch(this.tag){case"None":return r.NoneType.get();case"Bool":return r.BoolType.get();case"Int":return r.IntType.get();case"Double":return r.FloatType.get();case"String":return r.StringType.get();case"Device":return r.DeviceObjType.get();case"Tuple":return r.TupleType.create(this.value.elements().map(e=>e.type()));case"Enum":return this.toEnumHolder().type();default:throw new l.Error(`IValue.type('${this.tag}') not implemented.`)}}}),this.registerFunction("torch._C.indent",(e,t)=>{for(let s=0;s<t;s++)e.write(" ");return e}),this.registerFunction("torch._C.printValueRef",(e,t)=>{e.write(`%${t.debugName()}`)}),this.registerFunction("torch._C.printValueRefs",(e,t)=>{for(let s=0;s<t.length;s++){let i=t[s];s>0&&e.write(", "),r._C.printValueRef(e,i)}return e}),this.registerFunction("torch._C.const_value_list_with_types",(e,t,s)=>{for(let i=0;i<t.length;i++){let n=t[i];i>0&&e.write(s),r._C.printValueRef(e,n),e.write(" : "),e.write(n.type().str())}}),this.register("torch.jit._script"),this.register("torch.jit._trace"),this.registerType("torch._C.Parser",class{constructor(e){this.L=e}parse(){return h.parse(this.L.text_str(),this.L.filename())}parseExp(){return h.parse(this.L.text_str()).body[0].value}}),this.registerType("torch._C.StringCordView",class{}),this.registerType("torch._C.Source",class{constructor(e,t,s,i){if(e instanceof Uint8Array){let n=new TextDecoder("utf-8");this._text_view=n.decode(e)}else if(typeof e=="string")this._text_view=e;else throw new l.Error("Invalid text view.");this._filename=t,this._starting_line_no=s,this._gen_ranges=i,this.calc_line_start_offsets()}text_str(){return this._text_view}size(){return this._text_view.length}filename(){return this._filename}calc_line_start_offsets(){let e=0;for(this._line_starting_offsets=[0];(e=this._text_view.indexOf(`
|
|
35
|
+
`,e))!==-1;)e+=1,this._line_starting_offsets.push(e)}offset_for_line(e){return this._line_starting_offsets[e]}lineno_for_offset(e){let t=this._line_starting_offsets.findIndex(s=>s>e);return(t===-1?this._line_starting_offsets.length:t)-1}lineno_to_source_lineno(e){return this._filename?e+this._starting_line_no:e}findSourceRangeThatGenerated(e){return this._gen_ranges?this._gen_ranges.findSourceRangeThatGenerated(e):null}}),this.registerType("torch._C.SourceRange",class{constructor(...e){if(e.length===0)this._source_view=null;else if(e.length===2){let t=null;[this._source_view,t]=e,this._start=this._source_view.offset_for_line(t.lineno-1)+(t.col_offset-1),this._end=this._source_view.offset_for_line(t.end_lineno-1)+(t.end_col_offset-1)}else if(e.length===3)[this._source_view,this._start,this._end]=e;else throw new l.Error("Not implemented.")}source(){return this._source_view}file_line_col(){if(!this._source_view||this.source().filename()===null)return null;let e=this._source_view.lineno_for_offset(this._start),t=this._start-this._source_view.offset_for_line(e);return[this._source_view.filename(),this._source_view.lineno_to_source_lineno(e),t]}start(){return this._start}toString(){let e=this.file_line_col();return e?`${e[0]}:${e[1]}:${e[2]}`:""}}),this.registerType("torch._C.QualifiedName",class{constructor(...e){let t=null;e.length===1&&typeof e[0]=="string"?[t]=e:e.length===1&&Array.isArray(e[0])&&e[0].every(i=>typeof i=="string")?t=e[0].join("."):t=`${e[0].qualifiedName()}.${e[1]}`;let s=t.lastIndexOf(".");this._qualifiedName=t,this._prefix=s===-1?"":t.substring(0,s),this._name=s===-1?t:t.substring(s+1)}qualifiedName(){return this._qualifiedName}prefix(){return this._prefix}name(){return this._name}atoms(){return this._qualifiedName.split(".")}}),this.registerType("torch._C.Resolver",class{resolveValue(){throw new l.Error("Not implemented.")}resolveType(){throw new l.Error("Not implemented.")}}),this.registerFunction("torch._C.registerCustomClass",e=>{r._C.customClasses=r._C.customClasses||new Map,r._C.TORCH_INTERNAL_ASSERT(e.name());let t=e.name().qualifiedName();r._C.TORCH_CHECK(!r._C.customClasses.has(t)),r._C.customClasses.set(t,e)}),this.registerFunction("torch._C.getCustomClass",e=>(r._C.customClasses=r._C.customClasses||new Map,r._C.customClasses.has(e)?r._C.customClasses.get(e):null)),this.registerFunction("torch._C.isCustomClass",e=>e.isObject()&&e.toObject().type().name()&&r._C.getCustomClass(e.toObject().type().name().qualifiedName())),this.registerType("torch._C.SourceImporter",class extends r._C.Resolver{constructor(e,t,s,i){super(),this._cu=e,this._constant_table=t,this._source_loader=s,this._version=i,this._loaded_sources=new Set,this._sources=new Map;let n=this._sources;h.AST.prototype.range=function(){if(!this._range)if(n.has(this.filename)){let a=n.get(this.filename);this._range=new r._C.SourceRange(a,this)}else this._range=new r._C.SourceRange;return this._range},this._to_be_defined=new Map,this._env=new Map([["torch",new r._C.BuiltinModule("aten",i)],["ops",new r._C.OpsValue(i)],["CONSTANTS",new r._C.ConstantTableValue(t)],["fork",r._C.SpecialFormValue.create("prim::fork")],["awaitable",r._C.SpecialFormValue.create("prim::awaitable")],["annotate",r._C.SpecialFormValue.create("prim::annotate")],["unchecked_cast",r._C.SpecialFormValue.create("prim::unchecked_cast")],["uninitialized",r._C.SpecialFormValue.create("prim::Uninitialized")]])}loadType(e){return new r._C.ScriptTypeParser(this).parseType(e.qualifiedName())}resolveType(e){return e=new r._C.QualifiedName(e),this.findNamedType(e)}resolveValue(e,t,s){if(this._env.has(e))return this._env.get(e);let i=t.graph();switch(e){case"inf":return new r._C.SimpleValue(i.insertConstant(1/0,s));case"nan":return new r._C.SimpleValue(i.insertConstant(NaN,s));case"infj":return new r._C.SimpleValue(i.insertConstant("c10::complex<double>(0, std::numeric_limits<double>::infinity())",s));case"nanj":return new r._C.SimpleValue(i.insertConstant("c10::complex<double>(0, std::numeric_limits<double>::quiet_NaN()",s));case"__torch__":return new r._C.ClassNamespaceValue(new r._C.QualifiedName(e),this);default:return null}}findNamedType(e){let t=r._C.getCustomClass(e.qualifiedName());if(t)return t;this.parseSourceIfNeeded(e.prefix());let s=e.qualifiedName(),i=this._to_be_defined.get(s);return i&&i instanceof h.ClassDef&&(this._to_be_defined.delete(s),this.importNamedType(e.prefix(),i)),this._cu.get_type(e)}importNamedType(e,t){let s=new r._C.QualifiedName(`${e}.${t.name}`);if(t.bases.length===0){this.importClass(s,t,!1);return}let i=t.bases[0].id;if(i==="Module")this.importClass(s,t,!0);else if(i==="NamedTuple")this.importNamedTuple(s,t);else if(i!=="Interface"){if(i!=="ModuleInterface")if(i==="Enum")this.importEnum(s,t);else throw new l.Error("TorchScript does not support class inheritance.")}}importClass(e,t,s){if(e.prefix().startsWith("__torch__.torch.classes"))return;let i=new Set,n=new Set,a=[],o=[],c=[],u=[],d=new Set,_=new Map,f=new Set,g=new Map,y=r.ClassType.create(e.qualifiedName(),this._cu,s);for(let v of t.body)if(v instanceof h.Assign||v instanceof h.AnnAssign){let A=null,I=null,E=null;if(v instanceof h.Assign?([A]=v.targets,E=v.value):(A=v.target,I=v.annotation,E=v.value),A instanceof h.Name){let O=this._cu.execution.identifier(A);switch(O){case"__annotations__":continue;case"__parameters__":{for(let M of E.elts)i.add(M.value);break}case"__buffers__":{for(let M of E.elts)n.add(M.value);break}case"__forward_pre_hooks__":{for(let M of E.elts)d.add(M.value);break}case"__forward_hooks__":{for(let M of E.elts)f.add(M.value);break}default:{let M=this.attributeAssignmentSpecialHandlingHack(e,v);M?c.push({name:M.target.id,value:M.value,annotation:M.annotation}):E?u.push({name:O,value:E,annotation:I}):c.push({name:O,value:E,annotation:I});break}}}else if(A instanceof h.Subscript&&A.value instanceof h.Name&&A.value.id==="__annotations__"){let O=A.slice.value;c.push({name:O,value:E,annotation:v.value});continue}else throw new l.Error("Unexpected statement kind in module metadata.")}else if(v instanceof h.FunctionDef){let A=v,I=A.name;d.has(I)?_.set(I,A):f.has(I)?g.set(I,A):(a.push(A),o.push(this))}else throw new l.Error("Unexpected statement kind in class body.");let x=new r._C.ScriptTypeParser(this);for(let v of c){let A=v.name,I=x.parseTypeFromExpr(v.annotation),E=i.has(A),O=n.has(A);y.addAttribute(A,I,E,O)}for(let v of u)y.addConstant(v.name,v.value);this._cu.register_type(y);let F=new r._C.SimpleSelf(y);this._cu.define(e,[],[],a,o,F,!1,this._version)}importEnum(e,t){let s=[],i=null,n=o=>{if(!i)i=o;else if(i!==o)throw new l.Error("Enum class with varying value types are not supported.")};for(let o of t.body){if(!(o instanceof h.Assign))throw new l.Error("Unexpected statement in Enum class body.");let c=o,u=c.targets[0].id,d=null,_=c.value;switch(_.type){case"str":d=new r._C.IValue(_.value),n(r.StringType.get());break;default:throw new l.Error(`Unsupported enum value type '${_.type}'.`)}s.push([u,d])}if(!i)throw new l.Error("No enum values defined.");let a=r.EnumType.create(e,i,s,this._cu);this._cu.register_type(a)}importNamedTuple(e,t){let s=new r._C.ScriptTypeParser(this),i=[],n=[],a=[];for(let c of t.body){if(!(c instanceof h.AnnAssign))throw new l.Error("Unexpected statement in NamedTuple body.");let u=c,d=this._cu.execution.identifier(c.target),_=s.parseTypeFromExpr(u.annotation);i.push(d),n.push(_)}let o=r.TupleType.createNamed(e.qualifiedName(),i,n,a);this._cu.register_type(o)}importFunction(e,t){let s=[t],i=[this];this._cu.define(new r._C.QualifiedName(e),[],[],s,i,null)}parseSourceIfNeeded(e){if(!e||this._loaded_sources.has(e))return;this._loaded_sources.add(e);let t=this._source_loader(e);if(!t)return;this._sources.set(t.filename(),t);let s=new r._C.Parser(t),i=s.parse();this.parsePossibleVersionNumber(s);for(let n of i.body)if(n instanceof h.ClassDef){let a=`${e}.${n.name}`;this._to_be_defined.set(a,n)}else if(n instanceof h.FunctionDef){let a=`${e}.${n.name}`;this._to_be_defined.set(a,n)}}parsePossibleVersionNumber(){}parseImports(){}attributeAssignmentSpecialHandlingHack(e,t){let s=new Map([["__torch__.torch.ao.nn.quantized.modules.linear.LinearPackedParams",["_packed_params","Tensor","__torch__.torch.classes.quantized.LinearPackedParamsBase"]],["__torch__.torch.ao.nn.quantized.modules.linear.Linear",["_packed_params","Tensor","__torch__.torch.classes.quantized.LinearPackedParamsBase"]],["__torch__.torch.ao.nn.quantized.dynamic.modules.linear.Linear",["_packed_params","Tensor","__torch__.torch.classes.quantized.LinearPackedParamsBase"]],["__torch__.torch.ao.nn.quantized.modules.conv.Conv2d",["_packed_params","Tensor","__torch__.torch.classes.quantized.Conv2dPackedParamsBase"]],["__torch__.torch.nn.intrinsic.quantized.modules.conv_relu.ConvReLU2d",["_packed_params","Tensor","__torch__.torch.classes.quantized.Conv2dPackedParamsBase"]],["__torch__.torch.ao.nn.quantized.modules.conv.Conv3d",["_packed_params","Tensor","__torch__.torch.classes.quantized.Conv3dPackedParamsBase"]],["__torch__.torch.nn.intrinsic.quantized.modules.conv_relu.ConvReLU3d",["_packed_params","Tensor","__torch__.torch.classes.quantized.Conv3dPackedParamsBase"]],["__torch__.torch.nn.quantized.modules.linear.LinearPackedParams",["_packed_params","Tensor","__torch__.torch.classes.quantized.LinearPackedParamsBase"]],["__torch__.torch.nn.quantized.modules.linear.Linear",["_packed_params","Tensor","__torch__.torch.classes.quantized.LinearPackedParamsBase"]],["__torch__.torch.nn.quantized.modules.conv.Conv2d",["_packed_params","Tensor","__torch__.torch.classes.quantized.Conv2dPackedParamsBase"]],["__torch__.torch.nn.quantized.modules.conv.Conv3d",["_packed_params","Tensor","__torch__.torch.classes.quantized.Conv3dPackedParamsBase"]],["__torch__.torch.nn.quantized.dynamic.modules.linear.Linear",["_packed_params","Tensor","__torch__.torch.classes.quantized.LinearPackedParamsBase"]]]),i=/\.___torch_mangle_\d+/g,n=e.qualifiedName().replace(i,"");if(s.has(n)){let a=t.target;if(!t.annotation||!(t.annotation instanceof h.Name))return null;let o=t.annotation.id,[c,u,d]=s.get(n);if(a.id===c&&o===u){let f=new r._C.Parser(new r._C.Source(d)).parseExp();return new h.AnnAssign(a,f,t.value,a instanceof h.Name)}}return null}LEGACY_import_methods(e,t){let s=new r._C.SimpleSelf(e.type()),i=e.type().name(),a=new r._C.Parser(t).parse();this.parsePossibleVersionNumber(a),this.parseImports(a);let o=[],c=[];for(let u of a.body)u instanceof h.FunctionDef&&(o.push(u),c.push(this));this._cu.define(i,[],[],o,c,s)}findFunction(e){this.parseSourceIfNeeded(e.prefix());let t=e.qualifiedName(),s=this._to_be_defined.get(t);return s&&s instanceof h.FunctionDef&&(this._to_be_defined.delete(t),this.importFunction(e.prefix(),s)),this._cu.find_function(e)}}),this.registerType("torch._C.FunctionResolver",class extends r._C.Resolver{constructor(e,t){super(),this._otherResolver=e,this._functionTable=t}resolveValue(e,t,s){let i=this._functionTable.get(e);return i?new r._C.FunctionValue(i):this._otherResolver.resolveValue(e,t,s)}resolveType(e,t){return this._otherResolver.resolveType(e,t)}}),this.registerType("torch._C.SourceRangeDeserializer",class{constructor(e){this.cached_sources=new Map,this._text_table=e||[]}deserialize(e){r._C.TORCH_INTERNAL_ASSERT(e.length===3);let[t,s,i]=e,n=this.deserialize_source(t);return new r._C.SourceRange(n,s,i)}deserialize_source(e){let t=e;if(this.cached_sources.has(t))return this.cached_sources.get(t);let s=null,i=t;if(r._C.TORCH_INTERNAL_ASSERT(i.length===3),this._text_table.length>0){let[n,a,o]=i;r._C.TORCH_CHECK(a<this._text_table.length);let c=this._text_table[a],u=[],d=[];for(let _ of n)u.push(this._text_table[_]),d.push(this._text_table[_]);s=new r._C.Source(u.join(""),c,o)}else{let[n,a,o]=i;s=new r._C.Source(n,a,o)}return this.cached_sources.set(t,s),s}}),this.registerType("torch._C.SourceRangeUnpickler",class{}),this.registerType("torch._C.ConcreteSourceRangeUnpickler",class extends r._C.SourceRangeUnpickler{constructor(e){super(),this.data=e,this.deserializer=null,this.unpickled_records=null}unpickle(){if(this.unpickled_records)return;let t=new D.Unpickler(this.data).load();r._C.TORCH_CHECK(t.length>0),this.unpickled_records=[];let s=null;t[0]==="FORMAT_WITH_STRING_TABLE"?(this.deserializer=new r._C.SourceRangeDeserializer(t[1]),s=t[2]):(this.deserializer=new r._C.SourceRangeDeserializer,s=t);for(let i of s){let[n,a]=i,o=this.deserializer.deserialize(a);this.unpickled_records.push([n,o])}}findSourceRangeThatGenerated(e){this.unpickle();let t=e.start(),s=this.unpickled_records;for(let i=0;i<s.length;i++){let[n,a]=s[i],o=i<s.length-1?s[i+1][0]:e.source().size();if(t>=n&&t<o)return a}return null}}),this.registerFunction("torch._C.qualifierToArchivePath",(e,t)=>`${t}${e.replace(/\./g,"/")}.py`),this.registerFunction("torch._C.findSourceInArchiveFromQualifier",(e,t,s)=>{let i=r._C.qualifierToArchivePath(s,t);if(!e.has_record(i))return null;let n=e.get_record(i),a=null,o=`${i}.debug_pkl`;if(e.has_record(o)){let c=e.get_record(o);a=new r._C.ConcreteSourceRangeUnpickler(c.peek())}return new r._C.Source(n.peek(),i,1,a)}),this.registerType("torch._C.ScriptModuleDeserializer",class{constructor(e,t,s,i,n){this._compilation_unit=e,this._reader=t,this._storage_context=n,this._code_prefix=!s&&!i?"code/":".data/ts_code/code/",this._pickle_dir_prefix=s||"",this._tensor_dir_prefix=i||"",this._constant_table=[];let a=o=>r._C.findSourceInArchiveFromQualifier(this._reader,this._code_prefix,o);this._source_importer=new r._C.SourceImporter(this._compilation_unit,this._constant_table,a,t.version())}deserialize(){let e=this._compilation_unit.execution,t=this._code_prefix;for(let o of this._reader.get_all_records())if(o.startsWith(t)&&o.endsWith(".py")){let c=o.substring(t.length),d=this._reader.get_record(o).peek();e.add(c,d)}let s=e.import("torch");if(e.builtins.torch=s,e.builtins.Tensor=s.Tensor,e.builtins.ops=s.ops,e.builtins.inf=s.inf,e.builtins.CONSTANTS={},e._resolver=this._source_importer,this._reader.has_record("model.json"))return this.LEGACY_deserialize();let i=this.readArchive("constants");for(let o=0;o<i.length;o++){let c=i[o];if(c&&c.__class__&&c.__class__.__module__.startsWith("__torch__.torch.classes.")){let u=this._source_importer.resolveType(`${c.__class__.__module__}.${c.__class__.__name__}`),d=s.ScriptObject.create(u);d._ivalue=c,c=d}e.builtins.CONSTANTS[`c${o}`]=c,this._constant_table.push(c)}let n=this.readArchive("data"),a=o=>{if(o.__class__){let c=`${o.__class__.__module__}.${o.__class__.__name__}`,u=this._source_importer.loadType(new s._C.QualifiedName(c)),d=u.is_module()?new s.ScriptModule(u,this._compilation_unit):new s.ScriptObject(u);for(let _=0;_<u.numAttributes();_++){let f=u.getAttributeName(_),g=u.getAttribute(_),y=o[f];if(g instanceof s.ClassType)d.__setattr__(f,a(y));else{if(g instanceof s.TensorType&&y&&y.__class__&&!(y instanceof s.Tensor)&&y.__class__.__module__==="__torch__.torch.classes.quantized"){let x=`${y.__class__.__module__}.${y.__class__.__name__}`;u._attributes[_].type=this._source_importer.resolveType(x)}d.__setattr__(f,o[f])}}for(let[_,f]of Object.entries(Object.getPrototypeOf(o)))f&&f.__class__===T.method&&(d[_]=f);return d}throw new l.Error("Module class not found.")};return a(n)}LEGACY_deserialize(){let e=this._compilation_unit.execution,t=e.proto.caffe2,s=e.import("torch"),n=this._reader.get_record("model.json").peek(),o=new TextDecoder("utf-8").decode(n),c=JSON.parse(o),u=e.proto.torch.ModelDef.decodeJson(c),d=new Map([[t.TensorProto.DataType.FLOAT,"Float"],[t.TensorProto.DataType.FLOAT16,"Half"],[t.TensorProto.DataType.DOUBLE,"Double"],[t.TensorProto.DataType.INT8,"Char"],[t.TensorProto.DataType.INT32,"Int"],[t.TensorProto.DataType.INT64,"Long"]]),_=(u.tensors||[]).map(y=>{let x=y.data.key;if(!d.has(y.data_type))throw new l.Error(`Unsupported tensor data type '${y.data_type}'.`);let F=d.get(y.data_type),v=y.dims?y.dims.map(j=>parseInt(j,10)):null,A=y.strides?y.strides.map(j=>parseInt(j,10)):null,I=e.resolve(`torch.${F}Storage`),E=(v||[]).reduce((j,X)=>j*X,1),O=parseInt(y.offset,10)||0,M=new I(E),G=M.dtype.itemsize(),P=this._reader.get_record(x);if(P){let j=P.peek(),X=E*G,ce=j.slice(O,O+X);M._set_cdata(ce)}let K=s._utils._rebuild_tensor(M,0,v,A);return K.name=x,K});e.builtins.CONSTANTS={};for(let y=0;y<_.length;y++)e.builtins.CONSTANTS[`c${y}`]=_[y];let f=[];if(this._reader.has_record("attributes.pkl")){let x=this._reader.get_record("attributes.pkl").peek(),v=new D.Unpickler(x).load();f.push(...v)}this._LEGACY_moduleStack=["__torch__"];let g=u.main_module;for(let y of _)this._constant_table.push(y);return this.LEGACY_convertModule(g)}LEGACY_convertModule(e){let t=new r._C.QualifiedName(e.name).atoms(),s=t.length;for(let a of t){let o=/^\d+$/.test(a)?`_${a}`:a;this._LEGACY_moduleStack.push(o)}let i=new r._C.QualifiedName(this._LEGACY_moduleStack),n=new r.ScriptModule(i,this._compilation_unit);for(let a of e.submodules||[]){let o=this.LEGACY_convertModule(a);n.register_module(a.name,o)}for(let a of e.parameters||[]){let o=this._constant_table[Number(a.tensor_id)];a.isBuffer?n.register_buffer(a.name,o):n.register_parameter(a.name,o,!1)}for(let a of e.attributes||[])if(!n.hasattr(a.name))throw new l.Error("Not implemented.");if(e.torchscript_arena){let c=e.torchscript_arena.key.substring(5).replace(/\.py$/,"").split("/").join("."),u=b.import(c);u.forward.__class__===b.builtins.function&&(n.forward=u.forward)}if(e.torchscript_debug_arena)throw new l.Error("Not implemented.");if(e.torchscript_arena){let a=e.torchscript_arena.key,c=this._reader.get_record(a).peek(),u=new r._C.Source(c,a);this._source_importer.LEGACY_import_methods(n,u)}if(e.get_state_attribute_id)throw new l.Error("Not implemented.");for(let a=0;a<s;a++)this._LEGACY_moduleStack.pop();return n}readArchive(e){let t=i=>this._source_importer.loadType(i),s=()=>{};return this.readArchiveAndTensors(e,this._pickle_dir_prefix,this._tensor_dir_prefix,t,s,this._device,this._reader,null,this._storage_context)}readArchiveAndTensors(e,t,s,i,n,a,o,c,u){let d=`${t+e}.pkl`,_=o.get_record(d);if(!_)throw new l.Error(`File '${d}' is not found.`);let f=_.peek(),g=s||`${e}/`,y=I=>{let E=o.get_record(g+I);return E.length<=262144?E.peek():E},F=this._compilation_unit.execution.__import__("pickle"),v=class extends F.Unpickler{find_class(I,E){return super.find_class(I,E)}},A=new v(f);return A.persistent_load=I=>{if(I[0]!=="storage")throw new l.Error(`Unsupported persistent load type '${I[0]}'.`);let[,E,O,,M]=I;if(u&&u.has_storage(O))return u.get_storage(O);let G=new E(M),P=y(O);return G._set_cdata(P),u&&u.add_storage(O),G},A.load()}}),this.registerType("torch._C.WithInsertPoint",class{constructor(...e){let t=null;if(e.length===1&&e[0]instanceof r.Block){let[s]=e;t=s.return_node()}else if(e.length===1&&e[0]instanceof r.Node)[t]=e;else throw new l.Error("Invalid arguments.");this._prev=t.owningGraph().insertPoint(),t.owningGraph().setInsertPoint(t)}dispose(){this._prev.owningGraph().setInsertPoint(this._prev)}}),this.registerType("torch._C.Environment",class{constructor(e,t,s,i){this.method=e,this.resolver=t,this.b=s,this.next=i,this.value_table=new Map,this.type_table=new Map,this.error_messages=new Map}setVariableTypeError(e,t){let s=this;for(;s.next;)s=s.next;s.error_messages.set(e,t)}insertLoad(e,t){let s=this.b.owningGraph(),i=s.insertNode(s.createLoad(e,t));return r._C.meaningfulName(e)&&i.output().setDebugName(e),new r._C.SimpleValue(i.output())}insertStore(e,t,s,i){let n=this.b.owningGraph();n.insertNode(n.createStore(e,s)).setSourceRange(t),this.type_table.set(e,i)}findInThisFrame(e){return this.value_table.has(e)?this.value_table.get(e):this.type_table.has(e)?this.insertLoad(e,this.type_table.get(e)):null}findInParentFrame(e){return this.next?this.next.findInAnyFrame(e):null}setType(e,t){this.type_table.set(e,t)}findInAnyFrame(e){let t=this;for(let s=t;s;s=s.next){let i=s.findInThisFrame(e);if(i)return i}return null}block(){return this.b}setVar(e,t,s){this.setSugaredVar(e,t,new r._C.SimpleValue(s),null)}setSugaredVar(e,t,s,i){let n=r._C.asSimple(s);n&&!n.hasDebugName()&&r._C.meaningfulName(t)&&n.node().owningBlock()===this.block()&&n.setDebugName(t);let a=this.findInParentFrame(t);if(a){if(i)throw new l.Error("Type already defined in an outer block.");if(!n)throw new l.Error("Only reassignments to first-class values are allowed.");let o=r._C.asSimple(a);if(!o)throw new l.Error("Only reassignments to first-class values are allowed.");let c=r._C.unshapedType(o.type());if(n=r._C.tryConvertToType(e,this.b.owningGraph(),c,n,!0),!n.type().isSubtypeOf(c))throw new l.Error("Incompatible types.")}if(n){if(i&&!n.type().isSubtypeOf(i))throw new l.Error("Invalid type.");let o=i||n.type();this.insertStore(t,e,n,o)}else this.value_table.set(t,s)}getSugaredVar(e,t,s){s=s||!0;let i=this.findInAnyFrame(e);if(i||(r._C.Environment.globals=r._C.Environment.globals||new Map([["print",new r._C.PrintValue],["tuple",r._C.SpecialFormValue.create("prim::TupleConstruct")],["float",new r._C.MagicMethod("__float__",new r._C.CastValue(r.FloatType.get(),"aten::Float"))],["int",new r._C.MagicMethod("__int__",new r._C.CastValue(r.IntType.get(),"aten::Int"))],["bool",new r._C.MagicMethod("__bool__",new r._C.CastValue(r.BoolType.get(),"aten::Bool"))],["str",new r._C.MagicMethod("__str__",new r._C.CastValue(r.StringType.get(),"aten::str"))],["getattr",r._C.SpecialFormValue.create("prim::GetAttr")],["hasattr",r._C.SpecialFormValue.create("prim::HasAttr")],["isinstance",r._C.SpecialFormValue.create("prim::isinstance")],["range",r._C.SpecialFormValue.create("prim::range")],["sorted",new r._C.BuiltinFunction("aten::sorted",null)]]),r._C.Environment.globals.has(e)&&(i=r._C.Environment.globals.get(e))),!i){let n=this.resolver.resolveType(e,t);n instanceof r.TupleType&&(i=new r.jit.NamedTupleConstructor(n))}if(i||(i=this.resolver.resolveValue(e,this.method,t)),!i){let n=this.resolver.resolveType(e,t);n instanceof r.ClassType&&(i=new r.jit.ClassValue(n))}if(!i&&s)throw new l.Error(`The name '${e}' is not defined.`);return i}getVar(e,t){return this.getSugaredVar(e,t).asValue(t,this.method)}definedVariables(){return Array.from(this.type_table.keys())}}),this.registerType("torch._C.Refinement",class{constructor(e,t){this._identifier=e,this._type=t}identifier(){return this._identifier}type(){return this._type}}),this.registerType("torch._C.RefinementSet",class{constructor(...e){if(e.length===1&&e[0]instanceof r._C.Refinement)this._true_refinements=[e[0]],this._false_refinements=[];else if(e.length===2&&e[0]instanceof r._C.Refinement&&e[1]instanceof r._C.Refinement)this._true_refinements=[e[0]],this._false_refinements=[e[1]];else if(e.length===2&&Array.isArray(e[0])&&Array.isArray(e[1]))[this._true_refinements,this._false_refinements]=e;else throw new l.Error("Not implemented.")}Not(){return new r._C.RefinementSet(this._false_refinements,this._true_refinements)}activeRefinements(){return this._true_refinements}}),this.registerFunction("torch._C.CondValue",class{constructor(...e){if(e.length===3)[this._value,this._refinements,this._static_if]=e;else if(e.length===4){let[t,s,i,n]=e;this._value=t.insertConstant(i,s),this._refinements=n,this._static_if=i}else throw new l.Error("Invalid number of arguments.")}value(){return this._value}staticIf(){return this._static_if}refinements(){return this._refinements}}),this.registerFunction("torch._C.asSimple",e=>e instanceof r._C.SimpleValue?e.getValue():null),this.registerFunction("torch._C.isNumber",e=>/^[0-9]+$/.test(e)),this.registerFunction("torch._C.normalizeAttrName",e=>r._C.isNumber(e)?`_${e}`:e),this.registerFunction("torch._C.meaningfulName",e=>e.length===0&&e[0]==="$"?!1:e[0]!=="_"?!0:!/\d+/.test(e.slice(1))),this.registerFunction("torch._C.materializeConstant",(e,t,s,i)=>{let n=`${e.value}:${e.tag}`,a=i.get(n);if(a)return a;let o=new r._C.WithInsertPoint(t.block().nodes().front()),c=t.insertConstant(e,s);return i.set(n,c),o.dispose(),c}),this.registerFunction("torch._C.getFullSchemaName",e=>e.overload_name?`${e.name}.${e.overload_name}`:e.name),this.registerFunction("torch._C.insertGraph",(e,t,s,i)=>{let n=o=>i.get(o);r._C.AT_ASSERT(t.inputs().length===s.length);for(let o=0;o<s.length;o++)i.set(t.inputs()[o],s[o]);for(let o of t.nodes()){let c=e.insertNode(e.createClone(o,n));for(let u=0;u<o.outputs().length;u++)i.set(o.outputs()[u],c.outputs()[u])}let a=[];for(let o of t.outputs())a.push(n(o));return a}),this.registerType("TemplateEnv",class{}),this.registerType("torch._C.BuiltinFunctionRegistry",class{constructor(){this.state="UNINITIALIZED",this._builtins_by_name=new Map}getAllBuiltinFunctionsFor(e){return this.state==="UNINITIALIZED"&&(this.loadBuiltinFunctions(),this.state="INITIALIZED"),this._builtins_by_name.has(e)?this._builtins_by_name.get(e):[]}loadBuiltinFunctions(){}loadSource(){}}),this.registerFunction("torch._C.getAllBuiltinFunctionsFor",e=>(r._C.registry=r._C.registry||new r._C.BuiltinFunctionRegistry,r._C.registry.getAllBuiltinFunctionsFor(e))),this.registerFunction("torch._C.get_operator_version_map",()=>new Map),this.registerFunction("torch._C.varargsCanBeUsedAsList",(e,t,s)=>{let i=t+1===e.arguments.length||e.arguments[t+1].kwarg_only,n=s.type;n instanceof r._C.DynamicType&&(n=n.fallback());let a=n instanceof r.ListType,o=a&&n.getElementType()instanceof r._C.VarType,c=s.N>0;return i&&a&&!c&&!o}),this.registerFunction("torch._C.isBlockListedSchema",e=>e.name==="aten::view"&&e.overload_name==="dtype"||e.name==="aten::max"&&e.overload_name==="unary_out"||e.name==="aten::min"&&e.overload_name==="unary_out"),this.registerFunction("torch._C.unwrapOptional",e=>e instanceof r._C.DynamicType?r._C.unwrapOptional(e.fallback()):e instanceof r.OptionalType?e.getElementType():e),this.registerFunction("torch._C.loadPossibleHistoricOps",(e,t)=>{let s=[];if(t===void 0)return s;for(let i of r._C.get_operator_version_map()){let n=i.first;if(n.substring(0,n.find("."))===e){let o=r._C.findUpgrader(i.second,t.value());o.has_value()&&s.push_back(o.value().old_schema)}}return s}),this.registerFunction("torch._C.isOpCurrentBasedOnUpgraderEntries",(e,t)=>{let s=e[e.length-1].bumped_at_version;return t<s}),this.registerFunction("torch._C.isOpSymbolCurrent",(e,t)=>{let s=r._C.get_operator_version_map().get(e);return s?r._C.isOpCurrentBasedOnUpgraderEntries(s,t):!0}),this.registerFunction("torch._C.packOutputs",(e,t,s)=>{if(t.length===1)return t[0];let i=null;if(s){let n=t.map(a=>a.type());i=r.TupleType.createNamed(null,s.value(),n)}return e.insertNode(e.createTuple(t,i)).output()}),this.registerFunction("torch._C.isIntOrFloatUsedAsList",(e,t)=>{let s=e.type();if(s!==r.FloatType.get()&&s!==r.IntType.get())return!1;let i=r._C.unwrapOptional(t.type);return i instanceof r.ListType&&i.getElementType()===s&&t.N}),this.registerFunction("torch._C.convertibleToList",(e,t)=>{let s=t;return s instanceof r.ListType?e.isSubtypeOf(t)?!0:e instanceof r.TupleType?e.elements().every(i=>i.isSubtypeOf(s.getElementType())):!1:!1}),this.registerFunction("torch._C.findInputWithName",(e,t,s)=>{for(let i=0;i<t.length;i++)if(s&&e==="self"&&t[i].name()==="input"||t[i].name()===e)return i;return null}),this.registerFunction("torch._C.tryCreateList",(e,t,s,i,n,a,o,c)=>{let u=new r.Argument("<varargs>",e),d=[];for(let _ of i){let f=r._C.tryMatchArgument(u,t,s,_,n,a,o,c);if(!f)return null;d.push(f)}return t.insertNode(t.createList(e,d)).output()}),this.registerType("torch._C.MatchTypeReturn",class{constructor(e){this._reason=e}static Success(){return new r._C.MatchTypeReturn(null)}success(){return this._reason===null}}),this.registerFunction("torch._C.matchTypeVariables",(e,t,s)=>{if(!e.hasFreeVariables())return e instanceof r._C.DynamicType?r._C.matchTypeVariables(e.fallback(),t,s):r._C.MatchTypeReturn.Success();if(e instanceof r._C.VarType){let i=s.has(e.name())?s.get(e.name()):null;return i===null?(s.set(e.name(),t),r._C.MatchTypeReturn.Success()):r._C.unifyTypes(i,t)?r._C.MatchTypeReturn.Success():new r._C.MatchTypeReturn("Cannot match var.")}else if(e instanceof r.ListType){if(t instanceof r.ListType){let i=r._C.matchTypeVariables(e.getElementType(),t.getElementType(),s);return i.success()?r._C.MatchTypeReturn.Success():i}else if(t instanceof r.TupleType){let i=r._C.unifyTypeList(t.elements(),"");if(i)return r._C.matchTypeVariables(e.getElementType(),i,s)}return new r._C.MatchTypeReturn("Cannot match list.")}else if(e instanceof r.TupleType){if(t instanceof r.TupleType){if(e.elements().length!==t.elements().length)return r._C.MatchTypeReturn("Cannot match tuples of mismatched size.");for(let i=0;i<e.elements().length;i++){let n=r._C.matchTypeVariables(e.elements()[i],t.elements()[i],s);if(!n.success())return n}return r._C.MatchTypeReturn.Success()}return new r._C.MatchTypeReturn("Cannot match tuple.")}else if(e instanceof r.FutureType){if(t instanceof r.FutureType){let i=r._C.matchTypeVariables(e.getElementType(),t.getElementType(),s);return i.success()?r._C.MatchTypeReturn.Success():i}return new r._C.MatchTypeReturn("Cannot match future.")}else if(e instanceof r.AwaitType){if(t instanceof r.AwaitType){let i=r._C.matchTypeVariables(e.getElementType(),t.getElementType(),s);return i.success()?r._C.MatchTypeReturn.Success():i}return new r._C.MatchTypeReturn("Cannot match await.")}else if(e instanceof r.RRefType){if(t instanceof r.RRefType){let i=r._C.matchTypeVariables(e.getElementType(),t.getElementType(),s);return i.success()?r._C.MatchTypeReturn.Success():i}return new r._C.MatchTypeReturn("Cannot match rref.")}else if(e instanceof r.OptionalType){if(t instanceof r.OptionalType){let i=r._C.matchTypeVariables(e.getElementType(),t.getElementType(),s);if(!i.success())return i}else if(!t.isSubtypeOf(r.NoneType.get()))return r._C.matchTypeVariables(e.getElementType(),t,s);return r._C.MatchTypeReturn.Success()}else if(e instanceof r.DictType){if(t instanceof r.DictType){let i=r._C.matchTypeVariables(e.getKeyType(),t.getKeyType(),s);if(!i.success())return i;let n=r._C.matchTypeVariables(e.getValueType(),t.getValueType(),s);return n.success()?r._C.MatchTypeReturn.Success():n}return new r._C.MatchTypeReturn("Cannot match dict.")}throw new l.Error("Unhandled free variable container.")}),this.registerFunction("torch._C.tryMatchArgument",(e,t,s,i,n,a,o,c)=>{let u=i.value(t);if(r._C.isIntOrFloatUsedAsList(u,e)){let f=Array(e.N).fill(u);u=t.insertNode(t.createList(u.type(),f)).output()}if(!r._C.matchTypeVariables(e.type,u.type(),c).success()){if(n)throw new l.Error(`Could not match type ${u.type().repr_str()} to ${e.type().repr_str()} in argument '${e.name()}'.`);return null}let _=r._C.tryEvalTypeVariables(e.type,c);if(!_){if(n)throw new l.Error(`Could not infer type for argument '${e.name}'.`);return null}if(u=r._C.tryConvertToType(s,t,_,u,o),!u.type().isSubtypeOf(_)){if(n)throw new l.Error(`Could not match type in argument '${e.name()}'.`);return null}return u}),this.registerFunction("torch._C.tryConvertToType",(e,t,s,i,n)=>{if(s instanceof r.OptionalType){let a=s;if(!(i.type()instanceof r.OptionalType)&&!i.type().isSubtypeOf(r.NoneType.get()))return r._C.tryConvertToType(e,t,a.getElementType(),i,n)}if(i.node().kind()==="prim::EmptyListLiteral"&&s instanceof r.ListType&&(i=t.insertNode(t.createList(s.getElementType(),[])).output()),i.type()instanceof r.TupleType){let a=i.type();if(r._C.convertibleToList(i.type(),r._C.unwrapOptional(s))){let o=r._C.createTupleUnpack(i),c=r._C.unwrapOptional(s).expect(r.ListType).getElementType();i=t.insertNode(t.createList(c,o)).output()}if(s instanceof r.TupleType){let o=s;if(!a.isSubtypeOf(o)&&o.elements().length===a.elements().length){let c=r._C.createTupleUnpack(i),u=[];for(let d=0;d<o.elements().length;d++)u.push(r._C.tryConvertToType(e,t,o.elements()[d],c[d],n));i=t.insertNode(t.createTuple(u)).output()}}}if(n){let a=i.type().isSubtypeOf(r.TensorType.get()),o=i.type()===r.NumberType.get(),c=s===r.FloatType.get(),u=s===r.ComplexType.get(),d=s===r.IntType.get(),_=s===r.NumberType.get();if(a?c?i=t.insert("aten::FloatImplicit",[new r._C.NamedValue(i)],[],e):u?i=t.insert("aten::ComplexImplicit",[new r._C.NamedValue(i)],[],e):d?i=t.insert("aten::IntImplicit",[new r._C.NamedValue(i)],[],e):_&&(i=t.insert("aten::ScalarImplicit",[new r._C.NamedValue(i)],[],e)):o?c?i=t.insert("aten::Float",[new r._C.NamedValue(i)],[],e):u?i=t.insert("aten::Complex",[new r._C.NamedValue(i)],[],e):d&&(i=t.insert("aten::Int",[new r._C.NamedValue(i)],[],e)):i.type()===r.BoolType.get()&&(c?i=t.insert("aten::Float",[new r._C.NamedValue(i)],[],e):(d||_)&&(i=t.insert("aten::Int",[new r._C.NamedValue(i)],[],e))),i.type().isSubtypeOf(r.StringType.get())&&s.isSubtypeOf(r.DeviceObjType.get()))return t.insert("aten::device",[new r._C.NamedValue(i)],[],e)}return i}),this.registerFunction("torch._C.tryEvalTypeVariables",(e,t)=>{if(!e.hasFreeVariables())return e instanceof r._C.DynamicType?r._C.tryEvalTypeVariables(e.fallback(),t):e;if(e instanceof r._C.VarType)return t.get(e.annotation_str);let s=e.containedTypes();if(s.length===0)return e;let i=[];for(let n of s){let a=r._C.tryEvalTypeVariables(n,t);if(!a)return null;i.push(a)}return e.withContained(i)}),this.registerFunction("torch._C.tryMatchSchema",(e,t,s,i,n,a,o,c)=>{if(r._C.isBlockListedSchema(e))return null;let u=null,d=new Map,_=[],f=n.map(()=>!1),g=e.name.startsWith("aten::"),y=0;for(let E=0;E<e.arguments.length;E++){let O=e.arguments[E],M=null;if(O.name==="self"&&a)M=a,a=null;else if(!O.kwarg_only&&y<i.length){if(c&&r._C.varargsCanBeUsedAsList(e,E,O)){let K=i[y].value(s).type();if(!(K instanceof r.ListType)&&!r._C.convertibleToList(K,r._C.unwrapOptional(O.type))){let j=r._C.unwrapOptional(O.type).expect(r.ListType).getElementType(),X=r._C.tryCreateList(j,s,t,i.slice(y),o,u,c,d);if(!X)return null;y=i.length,_.push(X);continue}}M=i[y],y++}else{let P=r._C.findInputWithName(O.name,n,g);if(Number.isInteger(P)){let K=n[P];if(f[P]){if(o)throw new l.Error(`Argument '${K.name()}' specified twice in schema.`);return null}f[P]=!0,M=K}else if(O.has_default_value())M=new r._C.NamedValue(O.default_value);else{if(o)throw new l.Error(`Argument '${O.name}' not provided.`);return null}}let G=r._C.tryMatchArgument(O,s,t,M,o,u,c,d);if(!G)return null;_.push(G)}if(a!==null){if(o)throw new l.Error("Provided self argument not used in schema.");return null}if(e.is_vararg)for(;y<i.length;y++)_.push(i[y].value(s));if(y<i.length){if(o)throw new l.Error("Too many positional arguments.");return null}for(let E=0;E<n.length;E++){let O=n[E];if(!f[E]){if(o)throw e.argumentIndexWithName(O.name())?new l.Error("Keyword argument specified twice."):new l.Error("Keyword argument unknown.");return null}}let x=e.returns,F=x.map(E=>{let O=r._C.tryEvalTypeVariables(E.type,d);if(!O)throw new l.Error("Unbound type variable.");return O}),v=x.every(E=>!E.name),A=null;v&&(A=x.map(E=>E.name));let I=r._C.getFullSchemaName(e);return new r._C.MatchedSchema(_,F,A,I)}),this.registerFunction("torch._C.matchSchema",(e,t,s,i,n,a)=>{a=a||null;let o=r._C.tryMatchSchema(e,t,s,i,n,a,null,!0);if(o)return o;throw new l.Error(`No matching schema '${e.name}' found.`)}),this.registerFunction("torch._C.matchSchemas",(e,t,s,i,n,a,o)=>{if(a=a||null,o=o||!1,r._C.TORCH_INTERNAL_ASSERT(e.length>0),e.length===1)return[0,r._C.matchSchema(e[0],t,s,i,n,a)];for(let c of[!1,!0])for(let u=0;u<e.length;u++){let d=r._C.tryMatchSchema(e[u],t,s,i,n,a,null,c);if(d)return[u,d]}if(!o)return r._C.matchSchemas(e,t,s,i,n,a,!0);throw new l.Error(`No matching schema '${e[0].name}' found.`)}),this.registerFunction("torch._C.emitBuiltinCall",(e,t,s,i,n,a)=>{let o=r._C.getAllOperatorsFor(s),c=r._C.getAllBuiltinFunctionsFor(s),u=t.get_op_version(),d=[],_=[];for(let y of o){let x=!1,F=r._C.getFullSchemaName(y.schema());if(Number.isInteger(u)){let v=r._C.get_operator_version_map().get(F);if(v){let A=r._C.findUpgrader(v.second,u.value());if(A.has_value()){let I=r._C.parseSchema(A.value().old_schema);_.push(I),x=!0}else if(!r._C.isOpCurrentBasedOnUpgraderEntries(v.second,u.value()))throw new l.Error("Valid upgrader must be present.")}}x||d.push(y.schema())}if(o.length===0){let y=r._C.loadPossibleHistoricOps(s,u);for(let x of y){let F=r._C.parseSchema(x);_.push(F)}}for(let y of _)d.push(y);for(let y of c)y.ensure_defined(),d.push(y.getSchema());if(d.length===0){let y=s;throw new l.Error(`Unknown built-in function '${y}'.`)}let f=r._C.matchSchemas(d,e,t,i,n,a);if(f[0]<o.length+_.length)return r._C.emitBuiltinNode(f[1],e,t,s,u);let g=c[f.first-o.size()];return r._C.insertGraph(t,r._C.toGraphFunction(g).graph(),f.second.inputs,new Map)[0]}),this.registerFunction("torch._C.emitBuiltinNode",(e,t,s,i,n)=>{let a=s.insertNode(s.create(i,e.inputs,0)).setSourceRange(t);for(let o of e.return_types)a.addOutput().setType(o);return!Number.isInteger(n)||r._C.isOpSymbolCurrent(e.schema_name,n)?a.getOperation():a.setHistoricSchemaName(e.schema_name),r._C.packOutputs(s,a.outputs(),e.return_field_names)}),this.registerFunction("torch._C.unshapedType",e=>{if(e.isSubtypeOf(r.TensorType.get()))return r.TensorType.get();let t=e.containedTypes();return t.length===0?e:e.withContained(t.map(s=>r._C.unshapedType(s)))}),this.registerFunction("torch._C.unifyTypesImpl",(e,t,s,i)=>{if(s=s||!1,i=i||null,e.isSubtypeOf(t))return t;if(t.isSubtypeOf(e))return e;if(e.kind()==="TensorType"&&t.kind()==="TensorType")return e.merge(t);if(e.isSubtypeOf(r.NoneType.get())&&!t.isSubtypeOf(r.NoneType.get()))return r.OptionalType.create(t);if(t.isSubtypeOf(r.NoneType.get())&&!e.isSubtypeOf(r.NoneType.get()))return r.OptionalType.create(e);if(e instanceof r.OptionalType){let o=r._C.unifyTypes(e.getElementType(),t);if(o)return r.OptionalType.create(o)}else if(t instanceof r.OptionalType){let o=r._C.unifyTypes(t.getElementType(),e);if(o)return r.OptionalType.create(o)}if(e instanceof r.TupleType&&t instanceof r.TupleType){if(e.elements().size()!==t.elements().size())return null;let o=[];for(let c=0;c<e.elements().length;c++){let u=r._C.unifyTypes(e.elements()[c],t.elements()[c],s);if(u)o.push(u);else return null}return r.TupleType.create(o)}if(e instanceof r.FutureType&&t instanceof r.FutureType){let o=r._C.unifyTypes(e.getElementType(),t.getElementType());if(o)return r.FutureType.create(o)}let n=r._C.unshapedType(e),a=r._C.unshapedType(t);return n.isSubtypeOf(a)?a:a.isSubtypeOf(n)?n:i&&e.isSubtypeOf(i)&&t.isSubtypeOf(i)?i:null}),this.registerFunction("torch._C.unifyTypes",(e,t,s,i)=>{let n=r._C.unifyTypesImpl(e,t,s,i);return s&&!n?r.UnionType.create([e,t]):n}),this.registerFunction("torch._C.unifyTypeList",(e,t,s,i)=>{if(e.length===0)return null;let[n]=e;for(let a=1;a<e.length&&n;a++){let o=r._C.unifyTypes(n,e[a],s,i);if(!o)return null;n=o}return n}),this.registerFunction("torch._C.insertableTensor",e=>!e.requires_grad()&&e.has_storage()&&!e.is_nested()),this.registerFunction("torch._C.insertableIValue",e=>{if(e.isInt()||e.isNone()||e.isBool()||e.isDouble()||e.isComplexDouble()||e.isString()||e.isDevice()||e.isEnum())return!0;if(e.isTensor())return r._C.insertableTensor(e.toTensor());if(e.isList()||e.isTuple()){let t=[];return e.isTuple()?t=e.toTupleRef().elements():t=e.toListRef(),t.every(s=>r._C.insertableIValue(s))}return e.isGenericDict()?e.toGenericDict().every(s=>r._C.insertableIValue(s.key())&&r._C.insertableIValue(s.value())):!1}),this.registerFunction("torch._C.insertConstant",(e,t,s,i)=>{s=s||null,i=i||null;let n=r._C.tryInsertConstant(e,t,s,i);if(n!==void 0)return n;throw new l.Error("Unsupported value kind.")}),this.registerFunction("torch._C.tryInsertConstant",(e,t,s,i)=>{if(t instanceof r._C.IValue){let o=e.create("prim::Constant");if(t.isTensor()){let c=t.toTensor();if(!r._C.insertableTensor(t.toTensor()))return o.destroy(),null;if(!c.defined())return o.destroy(),e.insertNode(e.createNone()).output();r._C.TORCH_INTERNAL_ASSERT(!c.requires_grad()),o.output().inferTypeFrom(c),o.t_("value",c)}else if(t.isInt())o.i_("value",t.toInt()),o.output().setType(r.IntType.get());else if(t.isDouble())o.f_("value",t.toDouble()),o.output().setType(r.FloatType.get());else if(t.isComplexDouble())o.c_("value",t.toComplexDouble()),o.output().setType(r.ComplexType.get());else if(t.isBool())o.i_("value",t.toBool()),o.output().setType(r.BoolType.get());else if(t.isList())if(t.isBoolList()||t.isIntList()||t.isDoubleList()||r._C.insertableIValue(t))o.ival_("value",t),o.output().setType(t.type());else return o.destroy(),null;else if(t.isString())o.s_("value",t.toStringRef()),o.output().setType(r.StringType.get());else if(t.isDevice())o.s_("value",t.toDevice().__str__()),o.output().setType(r.DeviceObjType.get());else if(t.isGenerator())o.ival_("value",t.toGenerator()),o.output().setType(r._C_._GeneratorType.get());else if(t.isStream())o.ival_("value",t),o.output().setType(r.StreamObjType.get());else if(t.isNone())o.output().setType(r.NoneType.get());else if(t.isTuple())if(r._C.insertableIValue(t))o.ival_("value",t),o.output().setType(t.type());else return o.destroy(),null;else if(t.isObject()){let c=t.toObjectRef();if(!c.type().is_module()&&(c.is_weak_compilation_ref()||c.is_empty_strong_compilation_ref()))o.ival_("value",t),o.output().setType(t.type());else return o.destroy(),null}else if(t.isGenericDict()&&r._C.insertableIValue(t)||t.isEnum())o.ival_("value",t),o.output().setType(t.type());else return o.destroy(),null;return s&&o.setSourceRange(s),i&&o.setScope(i),e.insertNode(o).output()}let n=e.create("prim::Constant"),a=null;if(t===null)n.ival_("value",t),a=r.NoneType.get();else if(typeof t=="string")n.s_("value",t),a=r.StringType.get();else if(Array.isArray(t)&&t.every(o=>typeof o=="string"))n.ss_("value",t),a=r.ListType.create(r.StringType.get());else if(typeof t=="boolean")n.i_("value",t===!0?1:0),a=r.BoolType.get();else if(!t.type&&Number.isInteger(t)||t.type==="int")n.i_("value",t),a=r.IntType.get();else if(!t.type&&typeof t=="number"||t.type==="float")n.f_("value",t),a=r.FloatType.get();else if(t instanceof r.Tensor)n.t_("value",t),a=r.TensorType.get();else if(t instanceof r.ScriptObject)n.ival_("value",t),a=t.type();else if(Array.isArray(t)&&t.every(o=>Number.isInteger(o)))n.ival_("value",t),a=r.ListType.create(r.IntType.get());else throw new l.Error(`Unsupported value type '${typeof t}'.`);return a&&n.output().setType(a),s&&n.setSourceRange(s),i&&n.setScope(i),e.insertNode(n).output()}),this.registerFunction("torch._C.toIValue",e=>{if(e.node().kind()!=="prim::Constant"||e.type()instanceof r._C.FunctionType)return null;let t=e.node(),s=e.type();if(s.isSubtypeOf(r.TensorType.get()))return new r._C.IValue(t.t("value"),"Tensor");if(s.isSubtypeOf(r.BoolType.get()))return new r._C.IValue(Boolean(t.i("value"),"Bool"));if(s.isSubtypeOf(r.NumberType.get())&&t.kindOf("value")==="i")return new r._C.IValue(t.i("value"),"Int");if(s.isSubtypeOf(r.NumberType.get())&&t.kindOf("value")==="f")return new r._C.IValue(t.f("value"),"Double");if(s.isSubtypeOf(r.NumberType.get())&&t.kindOf("value")==="c")return new r._C.IValue(t.c("value"),"Complex");if(s instanceof r.ListType&&t.kindOf("value")==="ival"){let i=new r._C.IValue(t.ival("value"));return r._C.TORCH_INTERNAL_ASSERT(i.isList()),i}else if(s instanceof r.DictType&&t.kindOf("value")==="ival"){let i=t.ival("value");return r._C.TORCH_INTERNAL_ASSERT(i.isGenericDict()),i}else if(s instanceof r.TupleType&&t.kindOf("value")==="ival"){let i=t.ival("value");return r._C.TORCH_INTERNAL_ASSERT(i.isTuple()),i}else{if(s===r.StringType.get())return new r._C.IValue(t.s("value"),"String");if(s===r.DeviceObjType.get()){let i=new r.device(t.s("value"));return new r._C.IValue(i)}else{if(s===r._C._GeneratorType.get())throw new l.Error("Not implemented.");if(s===r.StreamObjType.get())throw new l.Error("Not implemented.");if(t.mustBeNone())return new r._C.IValue;if(s.kind()==="EnumType")return t.ival("value");if(s instanceof r.ClassType&&!s.is_module()){let i=t.ival("value");return new r._C.IValue(i,"Object")}}}throw new l.Error("Unsupported constant literal.")}),this.registerFunction("torch._C.constant_as",(e,t,s)=>{let i=r._C.toIValue(e);return i?i[t]():s===void 0?null:s}),this.registerType("torch._C.NamedValue",class{constructor(...e){if(e.length===1)e[0]instanceof r.Value?[this._value]=e:[this._ivalue]=e;else if(e.length===3&&typeof e[1]=="string"&&e[2]instanceof r.Value)[this._loc,this._name,this._value]=e;else throw new l.Error("Invalid argument.")}name(){return this._name}value(e){return this._value?this._value:r._C.insertConstant(e,this._ivalue)}}),this.registerType("torch._C.SugaredValue",class{kind(){throw new l.Error("Not implemented.")}shouldEmitUnrolled(){return this.staticLen()!==null}}),this.registerType("torch._C.SimpleValue",class extends r._C.SugaredValue{constructor(e){super(),this._value=e}kind(){return`value of type '${this._value.type().annotation_str}'`}asValue(){return this._value}getValue(){return this._value}asTuple(e,t,s){let i=n=>new r._C.SimpleValue(n);if(this._value.type()instanceof r.TupleType)return r._C.createTupleUnpack(this._value).map(a=>i(a));if(this._value.type()instanceof r.ListType){if(!s)throw new l.Error("Cannot statically infer the expected size of a list in this context.");let n=this._value.owningGraph();return n.insertNode(n.createListUnpack(this._value,s)).outputs().map(o=>i(o))}else if(this._value.type().kind()==="AnyTupleType")throw new l.Error("Provided tuple is not fully defined including its element types.");throw new l.Error(`Cannot use '${this._value.type().toString()}' as tuple.`)}attr(e,t,s){if(this._value.type().isSubtypeOf(r.TensorType.get())&&r._C.builtin_cast_method_to_scalar_type().has(s))return new r._C.TensorCastValue(r._C.builtin_cast_method_to_scalar_type().get(s),new r._C.NamedValue(e,"self",this._value));if(this._value.type()instanceof r.TupleType)throw new l.Error("Not implemented.");if(this._value.type()instanceof r.AwaitType)throw new l.Error("Not implemented.");if(this._value.type()instanceof r.ClassType){let n=this._value.type();if(n.findMethod(s))return new r._C.MethodValue(this.getValue(),[s]);if(n.hasAttribute(s)){let o=t.graph(),c=o.insertNode(o.createGetAttr(this._value,s));return new r._C.SimpleValue(c.output())}let a=n.getProperty(s);if(a)return new r._C.MethodValue(this._value,[a.getter.name()]).call(e,t,{},{},1)}else{if(this._value.type()instanceof r.InterfaceType)throw new l.Error("Not implemented.");if(this._value.type()instanceof r.EnumType){let n=t.graph();if(s==="name"){let a=n.insertNode(n.createEnumName(this._value));return new r._C.SimpleValue(a.output())}if(s==="value"){let a=n.insertNode(n.createEnumValue(this._value));return new r._C.SimpleValue(a.output())}}}if(s==="type"){let n=r._C.BuiltinFunction.tryCreate("aten::to",new r._C.NamedValue(e,"self",this._value));if(n)return n}let i=r._C.BuiltinFunction.tryCreate(`aten::${s}`,new r._C.NamedValue(e,"self",this._value));if(i)return i;if(this._value.type().isSubtypeOf(r.TensorType.get())&&s==="tolist")return r._C.SpecialFormValue.create("prim::tolist");if(this._value.type().isSubtypeOf(r.TensorType.get())&&s==="__getitem__")return r._C.SpecialFormValue.create("aten::index");if(this._value.type()instanceof r._C._GeneratorType&&(s==="manual_seed"||s==="initial_seed"||s==="seed")){let n=r._C.BuiltinFunction.tryCreate(`aten::${s}`,new r._C.NamedValue(e,"self",this._value));if(n)return n}throw new l.Error("Object has no attribute or method.")}setAttr(e,t,s,i){let n=this._value.type();if(!(n instanceof r.ClassType))throw new l.Error("Cannot set attribute on non-class type.");let a=n,o=a.findAttribute(s);if(!o)if(t.name()==="__init__"&&t.graph().inputs().length>0&&t.graph().inputs()[0].type()===a){if(this.isRecursive(a,i.type()))throw new l.Error("Classes that recursively contain instances of themselves are not supported.");a.addAttribute(s,i.type()),o=i.type();let _=t.graph().insertPoint(),f=t.graph().block();if(_.owningBlock()!==f)throw new l.Error("First assignment cannot be in a control-flow block.")}else{let _=a.getProperty(s);if(_&&_.setter){new r._C.MethodValue(this._value,_.setter.name()).call(e,t,[i],[],1);return}throw _&&!_.setter?new l.Error("Tried to set read-only attribute."):new l.Error("Tried to set nonexistent attribute.")}if(r._C.AT_ASSERT(o),!i.type().isSubtypeOf(o))throw new l.Error("Wrong type for attribute assignment.");let u=t.graph();u.insertNode(u.createSetAttr(this._value,s,i))}getitem(e,t,s,i){let n=this.getValue(),a=n.type(),o=t.graph();if(a instanceof r.ListType||a instanceof r.StringType)return new r._C.SimpleValue(o.insert("aten::__getitem__",[new r._C.NamedValue(n),new r._C.NamedValue(s)],[],e));if(a instanceof r.DictType)return new r._C.SimpleValue(o.insert("aten::__getitem__",[new r._C.NamedValue(n),new r._C.NamedValue(s)],[],e));if(a.isSubtypeOf(r.TensorType.get()))return new r._C.SimpleValue(o.insert("aten::select",[new r._C.NamedValue(n),new r._C.NamedValue(0),new r._C.NamedValue(s)],[],e));if(a instanceof r.ClassType){if(a.is_module()&&i){let u=o.insert("prim::ModuleContainerIndex",[new r._C.NamedValue(n),new r._C.NamedValue(s)],[],e);return u.setType(i),new r._C.SimpleValue(u)}return this.attr(e,t,"__getitem__").call(e,t,[new r._C.NamedValue(s)],[],1)}throw new l.Error("Object is not subscriptable.")}}),this.registerType("torch._C.MethodValue",class extends r._C.SugaredValue{constructor(e,t){super(),this._self=e,this._method_names=t}call(e,t,s,i){let n=[new r._C.NamedValue(this._self),...s],a=[];for(let u of this._method_names){let d=this._self.type();if(d instanceof r.ClassType){let f=d.getMethod(u);f.ensure_defined(),a.push(f.getSchema())}else if(d instanceof r.InterfaceType){let _=d;a.push(_.getMethod(u))}else throw new l.Error("Method constructed that is not a class or interface.")}let o=r._C.matchSchemas(a,e,t.graph(),n,i),c=t.graph().insertMethodCall(this._method_names[o[0]],o[1]);return c.node().setSourceRange(e),new r._C.SimpleValue(c)}}),this.registerType("torch._C.ClassValue",class extends r._C.SugaredValue{constructor(e){super(),this._type=e}attr(e,t,s){let i=this._type.findHook(s);if(i)return new r._C.FunctionValue(i);if(s!=="__new__")throw new l.Error("Tried to lookup unknown attribute on class.");return r._C.SpecialFormValue.create("prim::CreateObject")}}),this.registerType("torch._C.NamedTupleConstructor",class extends r._C.SugaredValue{constructor(e){super(),this._type=e}call(e,t,s,i){let n=t.graph(),a=this._type.schema();r._C.TORCH_INTERNAL_ASSERT(a);let o=r._C.matchSchema(a,e,n,s,i),c=n.insertNode(n.createTuple(o.inputs,this._type).setSourceRange(e)).output();return c.setType(this._type),new r._C.SimpleValue(c)}}),this.registerType("torch._C.SugaredEnumClass",class extends r._C.SugaredValue{constructor(e){super(),this._enum_type=e}attr(e,t,s){let n=this._enum_type.enumNamesValues().find(o=>o[0]===s);if(n===null)throw new l.Error(`Enum '${this._enum_type.name()}' has no attribute '${s}'.`);let a=new r._C.EnumHolder(this._enum_type,n[0],n[1]);return new r._C.SimpleValue(t.graph().insertConstant(new r._C.IValue(a),e))}}),this.registerType("torch._C.EnumHolder",class{constructor(e,t,s){this._type=e,this._name=t,this._value=s}type(){return this._type}}),this.registerType("torch._C.FunctionValue",class extends r._C.SugaredValue{constructor(...e){if(super(),e.length===1&&e[0]instanceof r._C.Function)this._callees=[e[0]];else throw new l.Error("Not implemented.")}call(e,t,s,i){let n=[];for(let c of this._callees)c.ensure_defined(),n.push(c.getSchema());let a=r._C.matchSchemas(n,e,t.graph(),s,i),o=t.graph().insertFunctionCall(this._callees[a[0]],a[1]);return o.node().setSourceRange(e),new r._C.SimpleValue(o)}}),this.registerType("torch._C.NoneValue",class extends r._C.SugaredValue{}),this.registerType("torch._C.PrintValue",class extends r._C.SugaredValue{call(e,t,s,i){let n=t.graph();if(i.length>0)throw new l.Error(`Print doesn't accept any keyword arguments at ${e}.`);let a=r._C.toValues(t.graph(),s);return n.insertNode(n.create("prim::Print",a,0).setSourceRange(e)),new r._C.NoneValue}}),this.registerType("torch._C.SpecialFormValue",class extends r._C.SugaredValue{constructor(e){super(),this._form=e}form(){return this._form}static create(e){return new r._C.SpecialFormValue(e)}}),this.registerFunction("torch._C.makeMagic",(e,t)=>new r._C.MagicMethod(e,t)),this.registerType("torch._C.BuiltinFunction",class extends r._C.SugaredValue{constructor(e,t){super(),this.symbol=e,this.self=t}call(e,t,s,i){return new r._C.SimpleValue(r._C.emitBuiltinCall(e,t.graph(),this.symbol,s,i,this.self))}static tryCreate(e,t){for(let s of r._C.getAllOperatorsFor(e)){if(!t)return new r._C.BuiltinFunction(e,null);let i=s.schema().argumentIndexWithName("self");if(i){let n=new Map,a=s.schema().arguments()[i].type();if(!r._C.matchTypeVariables(a,t.type(),n).success())continue;let c=r._C.tryEvalTypeVariables(a,n);if(!c||!t.type().isSubtypeOf(c))continue;return new r._C.BuiltinFunction(e,t)}}return null}}),this.registerType("torch._C.BuiltinModule",class extends r._C.SugaredValue{constructor(e,t){super(),this.name=e,this.version=t||null}attr(e,t,s){if(s==="autograd")return new r._C.BuiltinModule("aten",this.version);let i=`${this.name}::${s}`;return new r._C.BuiltinFunction(i,null)}}),this.registerType("torch._C.OpsValue",class extends r._C.SugaredValue{constructor(e){super(),this._version=e}attr(e,t,s){return new r._C.BuiltinModule(s,this._version)}}),this.registerType("torch._C.ConstantTableValue",class extends r._C.SugaredValue{constructor(e){super(),this._constants=e,this.non_holding_object_cache=new Map}attr(e,t,s){let i=parseInt(s.substring(1),10);if(!Number.isInteger(i))throw new l.Error(`Invalid constant identifier '${s}.`);if(i<0||i>=this._constants.length)throw new l.Error("Invalid constant index.");let n=new r._C.IValue(this._constants[i]),a=null;if(n.isObject()&&!n.toObject().is_weak_compilation_ref()){let o=n.toObject();this.non_holding_object_cache.has(o)||this.non_holding_object_cache.set(o,o.copy_to_weak_compilation_ref()),a=t.graph().insertConstant(this.non_holding_object_cache[o],e)}else a=t.graph().insertConstant(this._constants[i],e);return a.setType(r._C.unshapedType(a.type())),new r._C.SimpleValue(a)}}),this.registerType("torch._C.CastValue",class extends r._C.BuiltinFunction{constructor(e,t){super(t,null),this._type=e}call(e,t,s,i,n){if(s.length===1&&i.length===0){let a=new r._C.BuiltinFunction("aten::len",null),o=new r._C.BuiltinFunction("aten::gt",null),c=t.graph().insertConstant(0),u=s[0].value(t.graph());if(u.type().isSubtypeOf(this._type))return new r._C.SimpleValue(u);if(this._type===r.BoolType.get()&&(u.type().isSubtypeOf(r.Type.get("AnyListType"))||u.type().isSubtypeOf(r.StringType.get())||u.type()instanceof r.DictType)){let d=a.call(e,t,[u],[],1);return o.call(e,t,[d.asValue(e,t),c],[],1)}}return super.call(e,t,s,i,n)}}),this.registerType("torch._C.MagicMethod",class extends r._C.SugaredValue{constructor(e,t){super(),this._base_value=t,this._desugared_name=e}call(e,t,s,i,n){if(s.length>0){let a=s[0].value(t.graph());if(a.type()instanceof r.ClassType)return new r._C.SimpleValue(a).attr(e,t,this._desugared_name).call(e,t,s.slice(1),i,n)}if(!this._base_value)throw new l.Error("Invalid magic method.");return this._base_value.call(e,t,s,i,n)}}),this.registerType("torch._C.RangeValue",class extends r._C.SugaredValue{constructor(e,t,s,i){if(super(),i=i||null,s.length===0||s.length>3||!s.every(a=>a.type()instanceof r.IntType))throw new l.Error("Invalid range inputs.");let n=t.graph();s.length===1?([this._end]=s,this._start=n.insertConstant(0,e),this._step=n.insertConstant(1,e),this._has_only_end=!0):([this._start,this._end]=s,this._step=s.length===3?s[2]:n.insertConstant(1,e),this._has_only_end=!1),this._static_len=i}staticLen(){return this._static_len}iter(){return this}len(e,t){return this._static_len?r._C.insertConstant(t.graph(),this._static_len,e):this._has_only_end?this._end:t.graph().insert("aten::__range_length",[this._start,this._end,this._step],[],e)}getitem(e,t,s){if(this._has_only_end)return new r._C.SimpleValue(s);let i=t.graph();return new r._C.SimpleValue(i.insert("aten::__derive_index",[s,this._start,this._step],[],e))}}),this.registerType("torch._C.SliceValue",class extends r._C.SugaredValue{}),this.registerType("torch._C.ClassNamespaceValue",class extends r._C.SugaredValue{constructor(e,t){super(),this._basename=e,this._si=t}attr(e,t,s){let i=new r._C.QualifiedName(this._basename,s),n=this._si.findNamedType(i);if(n){if(n instanceof r.ClassType)return new r._C.ClassValue(n);if(n instanceof r.TupleType)return new r._C.NamedTupleConstructor(n);if(n instanceof r.EnumType)return new r._C.SugaredEnumClass(n)}let a=this._si.findFunction(i);return a?new r._C.FunctionValue(a):new r._C.ClassNamespaceValue(i,this._si)}}),this.registerType("torch.package.PackageImporter",class{constructor(e){this.zip_reader=e}load_pickle(e,t){let s=`${e.replace(/\./,"/")}/${t}`,i=this.zip_reader.get_record(s),n=new Map;this.storage_context=new r._C.DeserializationStorageContext;let a=new D.Unpickler(i);a.persistent_load=c=>{switch(c[0]){case"storage":{let[,u,d,,_]=c;if(!this.storage_context.has_storage(d)){let f=new u(_),y=this.zip_reader.get_record(`.data/${d}.storage`).peek();f._set_cdata(y),this.storage_context.add_storage(d,f)}return this.storage_context.get_storage(d)}case"reduce_package":{if(c.length===2){let[,f,g]=c;return b.invoke(f,g)}let[,u,d,_]=c;if(!n.has(u)){let f=b.invoke(d,[this].concat(_));n.set(u,f)}return n.get(u)}default:throw new l.Error(`Unknown package typename '${c[0]}'.`)}};let o=a.load();return this.storage_context=null,o}import_module(e){return b.import(e)}}),this.registerFunction("torch.jit.load",(e,t,s)=>{let i=new r.jit.CompilationUnit;i.execution=b;let n=r._C.import_ir_module(i,e,t,s),a=r.jit._script.wrap_cpp_module(n);return a.forward=n.forward,a}),this.registerFunction("torch._C.import_ir_module",function(e,t,...s){switch(arguments.length){case 4:{let[i,n]=s;return new r._C.ScriptModuleDeserializer(e,t).deserialize(i,n)}case 5:{let[i,n,a]=s;return new r._C.ScriptModuleDeserializer(e,t,`.data/ts_code/${a}/`,".data/",i).deserialize(n,null)}default:throw new l.Error("Invalid 'torch._C.import_ir_module' signature.")}}),this.registerFunction("torch._C._import_ir_module_from_package",(e,t,s,i,n)=>r._C.import_ir_module(e,t,s,null,n)),this.registerFunction("torch._C.tryToGraphFunction",e=>{if(e instanceof r.Node){let t=e;if(t.kind()==="prim::CallFunction"){r._C.AT_ASSERT(t.input(0).node().kind()==="prim::Constant");let i=t.input(0).node().output().type().expect(r._C.FunctionType);return r._C.tryToGraphFunction(i.function())}if(t.kind()==="prim::CallMethod"){let s=t.s("name"),i=t.input(0).type();if(i instanceof r.ClassType){let n=i.getMethod(s);return r._C.tryToGraphFunction(n)}}return null}else if(e instanceof r._C.Function){let t=e;return t.isGraphFunction()?t:null}throw new l.Error("Not implemented.")}),this.registerType("torch._C.ModuleInstanceInfo",class{constructor(e,t){this._module_type=e,this._instance_name=t}}),this.registerFunction("torch._C.slice_indices_adjust",(e,t,s,i)=>{if(r._C.TORCH_CHECK(i!==0),r._C.TORCH_CHECK(i>=-Number.MAX_SAFE_INTEGER),t._===Number.MAX_SAFE_INTEGER&&(t._=i<0?Number.MAX_SAFE_INTEGER:0),s._===Number.MAX_SAFE_INTEGER&&(s._=i<0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER),t._<0?(t._+=e,t._<0&&(t._=i<0?-1:0)):t._>=e&&(t._=i<0?e-1:e),s._<0?(s._+=e,s._<0&&(s._=i<0?-1:0)):s._>=e&&(s._=i<0?e-1:e),i<0){if(s._<t._)return Math.floor((t._-s._-1)/-i+1)}else if(t._<s._)return Math.floor((s._-t._-1)/i+1);return 0}),this.registerFunction("torch._C.createTupleUnpack",e=>{if(e.node().kind()==="prim::TupleConstruct")return e.node().inputs();let t=e.owningGraph();return t.insertNode(t.createTupleUnpack(e)).outputs()}),this.registerFunction("torch._C.inlineCallStackOfNode",()=>{}),this.registerFunction("torch._C.inlineCallTo",(e,t,s)=>{if(s===void 0||typeof s=="boolean"){let g=(s===void 0?!0:s)?t.optimized_graph():t.graph();return r._C.inlineCallTo(e,t,g)}if(!(s instanceof r.Graph))throw new l.Error("Invalid argument.");let i=s,n=new r._C.WithInsertPoint(e),a=new Map,o=r._C.insertGraph(e.owningGraph(),i,e.inputs(),a),c=new Map,u=null;if(e.kind()==="prim::CallMethod"){let f=e.input(0).type();e.input(0).node().kind()==="prim::GetAttr"?u=new r._C.ModuleInstanceInfo(f,e.input(0).node().s("name")):e.owningGraph().inputs().length>0&&e.input(0)===e.owningGraph().inputs()[0]?u=new r._C.ModuleInstanceInfo(f,"SELF"):u=new r._C.ModuleInstanceInfo(f,"INSTANCE_NAME_UNKNOWN")}let d=new Set;for(let f of a){if(i.inputs().indexOf(f[0])===-1)continue;let y=f[1].node();d.has(y)||(d.add(y),r._C.inlineCallStackOfNode(y,c,t,e,u))}let _=e.outputs();r._C.AT_ASSERT(o.length===_.length);for(let f=0;f<_.length;f++)_[f].hasDebugName()&&o[f].setDebugName(_[f].debugName()),_[f].replaceAllUsesWith(o[f]);return e.destroy(),n.dispose(),o}),this.registerFunction("torch._C.inlineCalls",e=>{for(let t of e.nodes())switch(t.kind()){case"prim::CallFunction":{let s=r._C.tryToGraphFunction(t);if(s){let i=t.input(0).node();t.removeInput(0);let n=null;if(i.hasAttribute("fallback")&&s.get_executor().isOptimized()){let o=s.get_executor().getDebugState().execution_plans;o.empty()||(n=o.begin().second.graph,r._C.Inline(n))}n===null&&(n=s.optimized_graph()),r._C.inlineCallTo(t,s,n)}break}case"prim::CallMethod":{let s=r._C.tryToGraphFunction(t);s&&r._C.inlineCallTo(t,s);break}default:for(let s of t.blocks())r._C.inlineCalls(s)}}),this.registerFunction("torch._C.Inline",e=>{r._C.inlineCalls(e.block())}),this.registerFunction("torch._C._jit_pass_inline",e=>{r._C.Inline(e)}),this.registerFunction("torch._C._set_tensor_metadata",()=>{}),this.registerFunction("torch.jit._script.unpackage_script_module",(e,t)=>{let s=new r.jit.CompilationUnit;s.execution=b;let i=r._C._import_ir_module_from_package(s,e.zip_reader,e.storage_context,e.last_map_location,t);return r.jit._script.wrap_cpp_module(i)}),this.registerFunction("torch.jit._script.wrap_cpp_module",e=>{let t=s=>{for(let[i,n]of new r.ModuleDict(s._c).items())s.__setattr__(i,r.jit._script.wrap_cpp_module(n))};return r.jit._script.RecursiveScriptModule._construct(e,t)}),this.registerType("torch._C.DeserializationStorageContext",class extends Map{has_storage(e){return this.has(e)}get_storage(e){return this.get(e)}add_storage(e,t){return this.set(e,t)}}),this.registerType("torch.ScriptFunction",class{constructor(e,t){this._name=e,this._graph=t}}),this.registerType("torch.ScriptMethod",class{constructor(e,t){this._owner=e,this._function=t}get name(){return this._function.name()}get owner(){return this._owner}__call__(){throw new l.Error}get graph(){return this._function.graph()}get schema(){throw new l.Error}get code(){throw new l.Error}get code_with_constants(){throw new l.Error}}),this.registerType("torch.ScriptObject",class{constructor(e){this._typ=e,this._ivalue={}}static create(e){return e.is_module()?new r.ScriptModule(e):new r.ScriptObject(e)}type(){return this._typ}_type(){return this._typ}__setstate__(e){let[t,s]=e;if(this._typ=r._C.getCustomClass(s),!this._typ)throw new l.Error(`Unsupported custom class '${s}'.`);for(let i=0;i<this._typ.numAttributes();i++){let n=this._typ.getAttributeName(i);this.__setattr__(n,t[i])}}find_method(e){for(let t of this.type().methods())if(t.name()===e)return new r.ScriptMethod(this,t);return null}_get_method(e){let t=this.find_method(e);return t||(r._C.TORCH_CHECK(!1,`Method '${e}' is not defined.`),null)}_has_method(e){return!!this.find_method(e)}_method_names(){return this.type().methods().map(e=>e.name())}__setattr__(e,t){this._ivalue[e]=t}__getattr__(e){return this._ivalue[e]}hasattr(e){return this._typ.hasAttribute(e)||this._typ.hasConstant(e)}getattr(e){return this.__getattr__(e)}_properties(){throw new l.Error}is_weak_compilation_ref(){return!0}}),this.registerType("torch.ScriptModule",class extends r.ScriptObject{constructor(...e){if(e[0]instanceof r._C.QualifiedName&&e[1]instanceof r.jit.CompilationUnit){let[t,s,i]=e;super(...r.ScriptModule.create_module_object(t,s,i))}else super(...e)}get qualified_name(){return this.type().qualified_name()}get code_with_constants(){let e={};return e.const_mapping=new Map(Object.entries(b.builtins.CONSTANTS)),[null,e]}get graph(){if(!this._graph){let e=this._typ.getMethod("forward");this._graph=e.graph()}return this._graph}static create_module_object(e,t,s){s=s||!1,e.prefix()||(e=new r._C.QualifiedName("__torch__",e.name())),s&&t.get_class(e)&&(e=t.mangle(e));let i=r.ClassType.create(e,t,!0);return t.register_type(i),[i,t]}register_module(e,t){this.type().addOrCheckAttribute(e,t.type()),this.__setattr__(e,t)}register_buffer(e,t){this.type().addOrCheckAttribute(e,r.TensorType.get(),!1,!0),this.__setattr__(e,t)}register_parameter(e,t,s){this.type().addOrCheckAttribute(e,r.TensorType.get(),!s,s),this.__setattr__(e,t)}register_attribute(e,t,s,i,n){this.type().addOrCheckAttribute(e,t,i,n)}}),this.registerType("torch.ModuleDict",class{constructor(e){this._module=e}items(){let e=new Map,t=this._module.type();for(let s=0;s<t.numAttributes();s++){let i=t.getAttributeName(s),n=t.getAttribute(s);n&&n.is_module()&&e.set(i,this._module.__getattr__(i))}return e}}),this.registerType("torch.ParameterDict",class{constructor(e){this._module=e}items(){let e=new Map,t=this._module.type();for(let s=0;s<t.numAttributes();s++)if(t.is_parameter(s)){let i=t.getAttributeName(s),n=this._module.__getattr__(i);n instanceof r.Tensor&&e.set(i,n)}return e}}),this.registerType("torch.BufferDict",class{constructor(e){this._module=e}items(){let e=new Map,t=this._module.type();for(let s=0;s<t.numAttributes();s++)if(t.is_buffer(s)&&t.getAttribute(s).isSubtypeOf(r.TensorType.get())){let n=t.getAttributeName(s),a=this._module.__getattr__(n);e.set(n,a)}return e}}),this.registerType("torch._C.to_ir",class{constructor(e,t,s,i){if(this.method=i,this.graph=i.graph(),this.resolver=t,this.integral_constants=new Map,this.fp_constants=new Map,this.complex_constants=new Map,this.exit_blocks=new Set,this._typeParser=new r._C.ScriptTypeParser(this.resolver),this._loop_status="NOT_IN_LOOP",this.environment_stack=null,this._def_stack=[],this._temp_name_count=0,r._C.AT_ASSERT(this.resolver),this.pushFrame(this.graph.block(),!0),s&&e&&e.args.args.length===0)throw new l.Error("Method must have a self argument.");i.setSchema(this.emitDef(e,s,this.graph.block())),r._C.ConvertToSSA(this.graph),r._C.CanonicalizeModifiedLoops(this.graph),r._C.NormalizeOps(this.graph.block()),r._C.runCleanupPasses(this.graph)}pushFrame(e,t){t=t||!1,t&&this._def_stack.push({}),this.environment_stack=new r._C.Environment(this.method,this.resolver,e,this.environment_stack)}popFrame(e){let t=this.environment_stack;return this.environment_stack=this.environment_stack.next,e&&this._def_stack.pop(),t}emitDef(e,t,s){let i=this._typeParser.parseSchemaFromDef(e,t!==null);i.returns.length===1&&(this._def_stack[this._def_stack.length-1]._declared_return_type=i.returns[0].type);let n=this.emitFormalArguments(e,t,i,s);this.emitStatements(e.body),this.handleMaybeNoReturn(e,s);let a=[this.emitOutput(e,i,s)];return new r.FunctionSchema(e.name,"",n,a)}emitFormalArguments(e,t,s,i){let n=[],a=e.args.args,o=t?e.args.args.length-1:e.args.args.length;if(s.arguments.length!==o)throw new l.Error("Invalid formal arguments.");let c=0;if(t){let _=a[c],f=_.arg,g=i.addInput().setDebugName(f);this.environment_stack.setSugaredVar(_.range(),f,t.makeSugared(g),null),n.push(new r.Argument(f,g.type())),c++}let u=this.shouldDeriveSetStateType(e,s),d=0;for(;c<a.length;c++){let _=a[c],f=_.arg,g=i.addInput();r._C.meaningfulName(f)&&g.setDebugName(f);let y=s.arguments[d++];if(u){if(s.arguments.length===1)throw new l.Error("Invalid schema.");let x=this.getTypeForSetStateArg(e,t);y=y.cloneWithType(x)}n.push(y),g.setType(y.type),this.environment_stack.setVar(_.range(),f,g)}return n}emitOutput(e,t,s){let i=this._def_stack[this._def_stack.length-1]._merged_return_type,n=this.graph.insertNode(this.graph.createUninitialized(i)).output();return s.registerOutput(n),new r.Argument("",this._def_stack[this._def_stack.length-1]._merged_return_type)}emitStatements(e){for(let t=0;t<e.length;t++){let s=e[t];if(s instanceof h.If)this.emitIf(s);else if(s instanceof h.While)this.emitWhile(s);else if(s instanceof h.For)this.emitFor(s);else if(s instanceof h.Assign)this.emitAssignment(s);else if(s instanceof h.AnnAssign)this.emitAssignment(s);else if(s instanceof h.Expr)this.emitSugaredExpr(s.value,0);else if(s instanceof h.Return)this.emitReturn(s);else if(!(s instanceof h.Pass))if(s instanceof h.With)this.emitWith(s);else throw new l.Error(`Unrecognized statement kind '${s.__class__.__name__}'.`);if(this.exit_blocks.has(this.environment_stack.block()))return}}emitWith(e){let t=e.items,s=[];for(let i of t){let n=i.context_expr,a=this.emitExpr(n),o=this.graph.insertNode(this.graph.create("prim::Enter",[a]));if(s.push(a),!(a.type()instanceof r.ClassType))throw new l.Error("With item expression must return an object.");let c=a.type(),u=c.findMethod("__enter__"),d=c.findMethod("__exit__");if(!u||!d)throw new l.Error("Object returned by with item expression does not define __enter__ and __exit__ methods.");let _=u.getSchema();if(_.arguments.length!==1)throw new l.Error("__enter__ must have only one argument and one return value.");let f=d.getSchema();if(f.arguments.length===4){for(let g=1;g<4;g++)if(f.arguments[g].type!==r.AnyType.get())throw new l.Error("Argument of __exit__ must have Any type.")}else throw new l.Error("__exit__ must have four arguments");if(o.output(0).setType(_.returns[0].type),i.optional_vars)throw new l.Error("Not implemented.")}for(this.emitStatements(e.body);s.length>0;){let i=s.pop(),n=this.graph.create("prim::Exit");this.graph.insertNode(n),n.addInput(i)}}emitLoopCommon(e,t,s,i,n){let a=null;s===null?a=r._C.materializeConstant(Number.MAX_SAFE_INTEGER,this.graph,e,this.integral_constants):a=s.len(e,this.method);let o=this.graph.insertNode(this.create("prim::Loop",e,0)),c=o.addBlock();{let _=o.addBlock();this.pushFrame(_);let f=null;if(n){let g=new r._C.WithInsertPoint(_);f=this.emitToBool(n.range(),this.emitExpr(n)),g.dispose()}else{let g=new r._C.WithInsertPoint(o);f=this.graph.insertConstant(!0,e),g.dispose()}_.registerOutput(f),this.popFrame()}o.addInput(a);let u=new r._C.WithLoopStatus(this,"IN_LOOP"),d=c.addInput().setType(r.IntType.get());{this.pushFrame(c);let _=new r._C.WithInsertPoint(c);if(s!==null&&i){let f=s.getitem(e,this.method,d).asValue(e,this.method),g=new r._C.SimpleValue(f),y=i;if(this.validateAssignLhsExpr(y,e),y.length>1)throw new l.Error("Not implemented.");this.emitExprsAssign(y,[g],e,1)}t(),this.popFrame(),_.dispose()}u.dispose()}emitFor(...e){if(e.length===1&&e[0]instanceof h.For){let[t]=e,s=()=>this.emitStatements(t.body);this.emitFor(t.target,t.iter,t.range(),s)}else if(e.length===4){let[t,s,i,n]=e;if(s instanceof h.Tuple)throw new l.Error("List of iterables is not supported currently.");let o=this.emitSugaredExpr(s,1).iter(i,this.method);o.shouldEmitUnrolled()?this.emitUnrolledLoop(i,n,o,t):this.emitLoopCommon(i,n,o,[t],null)}else throw new l.Error("Not implemented.")}emitWhile(e){let t=e.test,s=()=>this.emitStatements(e.body);this.emitLoopCommon(e.range(),s,null,[],t)}emitIsInstance(e,t){let s=this.emitExpr(e),i=[],n=[],a=v=>{if(v instanceof h.Tuple){for(let I of v.elts)a(I);return}let A=this._typeParser.parseTypeFromExpr(v);n.push(A)};i.push(s.type()),a(t),r._C.standardizeVectorForUnion(i),r._C.standardizeVectorForUnion(n);let o=new r._C.RefinementSet([],[]),c=null,u=null,d=[],_=[],f=[],g=[],y=!0;for(let v of i){if(v===r.AnyType.get()){d.push(...n),_.push(r.AnyType.get()),(d.length!==1||d[0]!==r.AnyType.get())&&(y=!1);break}let A=(E,O)=>E.isSubtypeOf(O)?E:O.isSubtypeOf(E)?O:null,I=null;for(let E of n){let O=A(v,E);if(O)O===v?I=v:O===E&&(I=I?r._C.unifyTypes(I,E):E);else continue}I?(I===v&&(y&=!0),d.push(I)):(_.push(v),y=!1)}if(d.length>0&&(c=r._C.unifyTypeList(d,null,!0)),e instanceof h.Name&&c){let v=e.id;f=[new r._C.Refinement(v,c)]}if(_.length>0&&(u=r._C.unifyTypeList(_,null,!0)),e instanceof h.Name&&u){let v=e.id;g=[new r._C.Refinement(v,u)]}o=new r._C.RefinementSet(f,g);let x=d.length===0;if(y)return new r._C.CondValue(this.graph,e.range(),!0,o);if(x)return new r._C.CondValue(this.graph,e.range(),!1,o);let F=this.graph.insertNode(this.graph.createIsInstance(s,n)).output();return new r._C.CondValue(F,o,null)}emitIf(e){let t=this.emitCondExpr(e.test);this.emitIfElseBlocks(e.range(),t,e.body,e.orelse)}emitCondExpr(e){if(e instanceof h.UnaryOp)throw new l.Error("Not implemented.");if(e instanceof h.Call){let a=e,o=e.func;if(o instanceof h.Name){if(o.id==="isinstance")return this.checkApplyNumInputs(a,2),this.emitIsInstance(a.args[0],a.args[1]);if(o.id==="hasattr")return this.checkApplyNumInputs(a,2),this.emitHasAttr(a.args[0],a.args[1]);let c=this.emitSugaredExpr(o,1);if(c instanceof r._C.SpecialFormValue&&c.form()==="prim::isinstance")return this.checkApplyNumInputs(a,2),this.emitIsInstance(a.inputs()[0],a.inputs()[1])}}let t=this.emitToBool(e,this.emitExpr(e)),s=null,i=t.node().kind();i==="aten::is_scripting"?s=!0:i==="aten::has_torch_function"&&(s=!1);let n=r._C.toIValue(t);return n&&(s=n.toBool()),new r._C.CondValue(t,new r._C.RefinementSet([],[]),s)}emitIfElseBlocks(e,t,s,i){if(t.staticIf()!==null){t.staticIf()?(this.insertRefinements(e,t.refinements()),this.emitStatements(s)):(this.insertRefinements(e,t.refinements().Not()),this.emitStatements(i));return}let n=this.graph.insertNode(this.create("prim::If",e,0));n.addInput(t.value());let a=n.addBlock(),o=n.addBlock(),c=this.emitSingleIfBranch(a,s,t.refinements()),u=this.emitSingleIfBranch(o,i,t.refinements().Not()),d=this.exit_blocks.has(a),_=this.exit_blocks.has(o);d&&_&&this.exit_blocks.add(n.owningBlock());let f=new Set;for(let g of c.definedVariables()){let y=new r._C.WithInsertPoint(o);u.findInAnyFrame(g)||_?f.add(g):this.environment_stack.setVariableTypeError(g,()=>"Value is not defined in the false branch."),y.dispose()}for(let g of u.definedVariables()){let y=new r._C.WithInsertPoint(a);c.findInAnyFrame(g)||d?f.add(g):this.environment_stack.setVariableTypeError(g,()=>"Value is not defined in the true branch."),y.dispose()}for(let g of f){let y=null,x=null;{let E=new r._C.WithInsertPoint(a);d||(y=c.getVar(g,e)),E.dispose()}{let E=new r._C.WithInsertPoint(o);_||(x=u.getVar(g,e)),E.dispose()}if(d&&_)continue;d?(y=this.graph.createUninitialized(x.type()).insertBefore(a.return_node()).output(),this.graph.createStore(g,y).insertBefore(a.return_node())):_&&(x=this.graph.createUninitialized(y.type()).insertBefore(o.return_node()).output(),this.graph.createStore(g,x).insertBefore(o.return_node()));let F=this.environment_stack.findInAnyFrame(g),v=null;if(F){let E=r._C.asSimple(F);E&&(v=E.type())}let A=v&&(v instanceof r.UnionType||v instanceof r.OptionalType||v instanceof r.NumberType),I=r._C.unifyTypes(y.type(),x.type(),A);if(!I){if(c.findInParentFrame(g)||u.findInParentFrame(g))throw new l.Error("Type mismatch.");this.environment_stack.setVariableTypeError(g,()=>"Type mismatch.");continue}this.environment_stack.setType(g,I)}}emitSingleIfBranch(e,t,s){this.pushFrame(e);let i=new r._C.WithInsertPoint(e);this.insertRefinements(t,s),this.emitStatements(t);let n=this.popFrame();return i.dispose(),n}create(e,t,s){return this.graph.create(e,s).setSourceRange(t)}refineAndSetUnionTypeHintOrPopulateCandidatesVector(e,t,s,i,n,a,o,c,u){if(u=u||!1,t._ instanceof r.UnionType){let d=t._.containedTypes().filter(_=>a(_));if(!u&&d.length===0)throw new l.Error("No matching types found in Union type annotation.");d.length===1?[t._]=d:s._=d}else t._ instanceof r.OptionalType&&(t._=t._.getElementType());if(!u&&s._.length===0)if(a(t._))o();else if(t._.kind()==="AnyType")c();else throw new l.Error("Invalid annotation type.")}emitToBool(e,t){let s=null,i=this.environment_stack.getSugaredVar("bool",e);if(s=r._C.asSimple(i.call(e,this.method,[new r._C.NamedValue(t)],[],0)),!s)throw new l.Error("Could not cast value to bool.");if(!s.type().isSubtypeOf(r.BoolType.get()))throw new l.Error("Expected a bool expression for condition.");return s}emitUnaryOp(e,t,s){let i=[e.operand],n=this.getNamedValues(i,!1),a=r._C.asSimple(r._C.makeMagic(t,new r._C.BuiltinFunction(s,null)).call(e.range(),this.method,n,[],0));if(a.node().kind()!==s)return a;let o=this.runNodeIfInputsAreConstant(a.node());return o?(r._C.TORCH_INTERNAL_ASSERT(o.length===1),this.graph.insertConstant(o[0],e)):a}emitAssignment(e){if(e instanceof h.AnnAssign)return this.emitSingleAssignment(e);if(e.targets.length===1){let t=Object.entries(e).filter(([i])=>i!=="targets"&&i!=="value"&&i!=="ctx"),s=new h.AnnAssign(e.targets[0],null,e.value,e.targets[0]instanceof h.Name);for(let[i,n]of t)s[i]=n;return this.emitSingleAssignment(s)}throw e.targets.length<=1?new l.Error("Invalid assignment."):new l.Error("Not implemented.")}emitSingleAssignment(e){r._C.AT_ASSERT(e instanceof h.AnnAssign);let t=e.value,s=e.target;if(s instanceof h.Name){let i=null;e.annotation&&(i=this._typeParser.parseTypeFromExpr(e.annotation));let n=this.emitSugaredExpr(t,1,i);this.environment_stack.setSugaredVar(e.range(),s.id,n,i)}else if(s instanceof h.Tuple)this.emitTupleAssign(s,t);else if(s instanceof h.Attribute)this.emitSelectAssign(s,t,null,e.range());else throw new l.Error("Unexpected expression on left-hand side of assignment.")}emitSelectAssign(e,t,s,i){if(!t)throw new l.Error("Expected RHS for assignment.");let n=null;s&&(n=this._typeParser.parseTypeFromExpr(s));let a=this.emitSugaredExpr(e.value,1),o=this.emitSugaredExpr(t,1,n).asValue(t.range(),this.method);a.setAttr(i,this.method,e.attr,o)}emitTupleAssign(...e){if(e.length===2){let[t,s]=e,i=t.elts.length,n=this.validateAssignLhsExpr(t.elts,t);n&&i--;let a=this.emitSugaredExpr(s,i);this.emitTupleAssign(t,a,s.range(),i,n)}else if(e.length===5){let[t,s,i,n,a]=e,o=s.asTuple(i,this.method,a?null:n);if(o.length<n)throw new l.Error("Not enough values to unpack.");if(o.length>n&&!a)throw new l.Error("Too many values to unpack.");this.emitExprsAssign(t.elts,o,i,n)}else throw new l.Error("Not implemented.")}emitExprsAssign(e,t){let s=0;for(let i of e){if(i instanceof h.Subscript)throw new l.Error("Not implemented.");if(i instanceof h.Name)this.environment_stack.setSugaredVar(i.range(),i.id,t[s],null),s++;else throw i instanceof h.Starred?new l.Error("Not implemented."):i instanceof h.Tuple?new l.Error("Not implemented."):i instanceof h.Attribute?new l.Error("Not implemented."):new l.Error("Unexpected expression on left-hand side of assignment.")}}emitReturn(e){let t=this._def_stack[this._def_stack.length-1]._declared_return_type,s=this.emitExpr(e.value,t);if(t){if(s.type().isSubtypeOf(r.TensorType.get())&&s.type().isSubtypeOf(r.NoneType.get())||(s=r._C.tryConvertToType(e,this.graph,t,s,!0)),!s.type().isSubtypeOf(t))throw new l.Error("Invalid return type.")}else{t=this._def_stack[this._def_stack.length-1]._merged_return_type,t||(t=s.type());let i=r._C.unifyTypes(t,s.type());if(!i)throw new l.Error("Invalid return type.");t=i}this._def_stack[this._def_stack.length-1]._merged_return_type=t,t===r.AnyType.get()&&s.type()!==r.AnyType.get()&&(s=this.graph.insertUncheckedCast(s,t)),this.graph.insertNode(this.graph.create("prim::ReturnStmt",[s],0)),this.exit_blocks.add(this.environment_stack.block())}getNamedValues(e,t){let s=[];for(let i of e){if(t&&i instanceof h.Starred)throw new l.Error("Starred argument not supported.");s.push(new r._C.NamedValue(this.emitExpr(i)))}return s}getValues(e,t){return this.getNamedValues(e,t).map(s=>s.value(this.graph))}emitExpr(e,t){t=t||null;let s=this.emitSugaredExpr(e,1,t).asValue(e,this.method);return t===r.AnyType.get()&&s.type()!==r.AnyType.get()&&(s=this.graph.insertUncheckedCast(s,t)),s}emitSugaredExpr(e,t,s){return e instanceof h.Name?this.environment_stack.getSugaredVar(e.id):e instanceof h.Attribute?this.emitSugaredExpr(e.value,1).attr(e.range(),this.method,e.attr):e instanceof h.Call?this.emitApplyExpr(e,t,s):e instanceof h.Subscript?this.emitSubscript(e,s):new r._C.SimpleValue(this.emitSimpleExpr(e,s))}emitApplyExpr(e,t,s){s=s||null;let i=this.emitSugaredExpr(e.func,1),n=e.func.range();if(i instanceof r._C.SpecialFormValue)return this.emitApplySpecialForm(i.form(),e,i,s);let a=this.getNamedValues(e.args,!0),o=this.emitAttributes(e.keywords);return i.call(n,this.method,a,o,t)}emitAttributes(e){return e.map(t=>new r._C.NamedValue(t.range(),t.arg,this.emitExpr(t.value)))}emitApplySpecialForm(e,t,s,i){switch(e){case"prim::fork":throw new l.Error("Not implemented.");case"prim::awaitable":throw new l.Error("Not implemented.");case"prim::annotate":{this.checkApplyNumInputs(t,2);let n=this._typeParser.parseTypeFromExpr(t.args[0]),a=r._C.tryConvertToType(t.range(),this.graph,n,this.emitExpr(t.args[1],n),!0);if(!a.type().isSubtypeOf(n))throw new l.Error("Invalid expression type.");if((n instanceof r.OptionalType||n instanceof r.UnionType&&n.expect(r.UnionType).canHoldType(r.NoneType.get()))&&a.type().isSubtypeOf(r.NoneType.get())){let o=this.graph.createNone();o.output().setType(n),this.graph.insertNode(o),a=o.output()}return new r._C.SimpleValue(a)}case"prim::unchecked_cast":{this.checkApplyNumInputs(t,2);let n=this._typeParser.parseTypeFromExpr(t.args[0]),a=this.emitExpr(t.args[1]);return(a.node().kind()!=="prim::unchecked_cast"||a.type()!==n)&&(a=this.graph.insertUncheckedCast(a,n)),new r._C.SimpleValue(a)}case"prim::GetAttr":{this.checkApplyNumInputsRange(t,2,3);let n=this.emitSugaredExpr(t.args[0],1);if(!(t.args[1]instanceof h.Constant)||typeof t.args[1].value!="string")throw new l.Error("Invalid argument.");let a=t.args[1].value;return t.args.length===2?n.attr(t,this.method,a):n.hasAttr(t,this.method,a)?n.attr(t,this.method,a):this.emitSugaredExpr(t.inputs()[2],1)}case"prim::Uninitialized":{this.checkApplyNumInputs(t,1);let n=this._typeParser.parseTypeFromExpr(t.args[0]),a=this.graph.insertNode(this.graph.createUninitialized(n)).setSourceRange(t.range());return new r._C.SimpleValue(a.output())}case"prim::TupleConstruct":throw new l.Error("Not implemented.");case"prim::isinstance":{this.checkApplyNumInputs(t,2);let n=this.emitIsInstance(t.args[0],t.args[1]);return new r._C.SimpleValue(n.value())}case"prim::tolist":{let n=t.func.value,a=this.emitSugaredExpr(n,1);if(!i)throw new l.Error("Expected type hint for result of tolist().");return new r._C.SimpleValue(this.graph.insertToList(a.asValue(n.range(),this.method),i))}case"prim::HasAttr":throw new l.Error("Not implemented.");case"prim::CreateObject":{if(t.args.length!==1)throw l.Error("Only one argument to __new__ allowed.");let n=this.emitSugaredExpr(t.args[0],1);if(!(n instanceof r._C.ClassValue))throw l.Error("Expected class value as argument to __new__.");let a=n,o=this.graph.insertNode(this.graph.createObject(a._type));return o.setSourceRange(t.range()),new r._C.SimpleValue(o.output())}case"prim::range":{let n=this.getValues(t.args,!0);return new r._C.RangeValue(t.range(),this.method,n)}case"prim::enumerate":throw new l.Error("Not implemented.");case"prim::zip":throw new l.Error("Not implemented.");case"prim::list":throw new l.Error("Not implemented.");case"prim::dict":throw new l.Error("Not implemented.");case"aten::index":throw new l.Error("Not implemented.");default:throw new l.Error(`Unsupported special form '${s.from()}'.`)}}emitSimpleExpr(e,t){if(e instanceof h.Constant)return e.value===!0?this.graph.insertConstant(!0,e.range()):e.value===!1?this.graph.insertConstant(!1,e.range()):e.value===null?this.graph.insertConstant(null,e.range()):typeof e.value=="string"?this.emitStringLiteral(e):this.emitConst(e);if(e instanceof h.List)return this.emitListLiteral(e,t);if(e instanceof h.UnaryOp&&e.op instanceof h.USub&&e.operand instanceof h.Name&&e.operand.id==="inf")return this.emitConst(new h.Constant(-1/0,"float"));if(e instanceof h.UnaryOp&&e.op instanceof h.USub)return this.emitUnaryOp(e,"__neg__","aten::neg");if(e instanceof h.Dict)return this.emitDictLiteral(e,t);if(e instanceof h.Tuple){let s=this.getValues(e.elts,!0);return this.graph.insertNode(this.graph.createTuple(s)).output()}throw new l.Error(`Simple expression '${e.__class__.__name__}' not implemented.`)}emitDictLiteral(e,t){let s=e.keys,i=e.values;r._C.AT_ASSERT(s.length===i.length);let n=[],a=[],o=null;for(let g=0;g<s.length;g++)if(n.push(this.emitExpr(s[g])),a.push(this.emitExpr(i[g])),g===0)o=a[g].type();else{if(n[g-1].type().kind()!==n[g].type().kind())throw new l.Error("Dict keys must contain only a single type.");o=r._C.unifyTypes(o,a[g].type(),!0)}let c={_:t},u=t&&t.isUnionType()?t:null,d={_:[]},_=()=>{if(n.length===0)c._=r.DictType.create(r.StringType.get(),r.TensorType.get());else if(c._=r.DictType.create(n[0].type(),o),o instanceof r.UnionType)throw new l.Error("Dict values consist of heterogeneous types.")};if(t){let g=y=>y instanceof r.DictType;if(this.refineAndSetUnionTypeHintOrPopulateCandidatesVector(t,c,d,"Dict",e,g,()=>[],_),d._.length>0&&a.length===0)throw new l.Error("Cannot assign an empty dict.")}else _();if(r._C.TORCH_INTERNAL_ASSERT(d._.length>0||c._),a.length>0){if(d._.length>0&&this.refineAndSetDictTypeHintFromCandidatesVector(d,t,c,n[0].type(),o,e),c._.getKeyType()!==n[0].type())throw new l.Error("Type annotation does not match key type.");if(!o.isSubtypeOf(c._.getValueType()))throw new l.Error("Type annotation does not match value type.")}let f=this.graph.insertNode(this.graph.createDict(c._.getKeyType(),c._.getValueType(),n,a));if(u){let g=this.graph.insertNode(this.graph.create("prim::unchecked_cast",[f.output()]));g.output().setType(u),f=g}return f.output()}emitStringLiteral(e){return r._C.insertConstant(this.graph,e.value,e.range())}emitConst(e){if(e.type==="int")return r._C.materializeConstant(new r._C.IValue(e.value,"Int"),this.graph,e.range(),this.integral_constants);if(e.type==="complex")return r._C.materializeConstant(new r._C.IValue(e.value,"Complex"),this.graph,e.range(),this.complex_constants);if(e.type==="float")return r._C.materializeConstant(new r._C.IValue(e.value,"Double"),this.graph,e.range(),this.fp_constants);throw new l.Error("Unsupported constant type.")}emitListLiteral(e,t){t=t||null;let s=this.getValues(e.elts,!0);if(s.length===0&&t===null)throw new l.Error("Not implemented.");let i=r.TensorType.get(),n={_:t},a=n._&&n._.isUnionType()?n._:null,o={_:[]};if(n._){let u=()=>{i=n._.expect(r.ListType).getElementType()},d=_=>_.isSubtypeOf(r.Type.get("AnyListType"));if(this.refineAndSetUnionTypeHintOrPopulateCandidatesVector(t,n,o,"List",e,d,u,u),o._.length>0&&s.len===0)throw new l.Error("Cannot assign an empty list.")}if(s.length!==0){let u=s.map(f=>f.type()),d=n._&&n._.kind()==="ListType"?n._.getElementType():null,_=r._C.unifyTypeList(u,null,!0,d);if(!n._&&_.kind()==="UnionType")throw new l.Error("Not implemented.");if(o._.length===0&&n._&&!_.isSubtypeOf(i))throw new l.Error("Not implemented.");o._.length!==0&&(this.refineAndSetListTypeHintFromCandidatesVector(o,t,n._,_,e),i=n._.expect(r.ListType).getElementType()),n._||(i=_)}let c=this.graph.insertNode(this.graph.createList(i,s));if(a){let u=this.graph.insertNode(this.graph.create("prim::unchecked_cast",[c.output()]));u.output().setType(a),c=u}return c.output()}insertRefinements(e,t){for(let s of t.activeRefinements()){let i=this.environment_stack.getVar(s.identifier(),e),n=this.graph.insertUncheckedCast(i,s.type());this.environment_stack.setVar(e,s.identifier(),n)}}shouldDeriveSetStateType(e,t){let s=t.arguments.every(n=>n.is_inferred_type());if(!(e.name==="__setstate__"&&s))return!1;if(e.name!=="__setstate__"&&e.args.args.length!==2)throw new l.Error("Invalid '__setstate' method.");return!0}checkApplyNumInputs(e,t){if(e.args.length!==t)throw new l.Error("Invalid number of arguments.");if(e.keywords.length>0)throw new l.Error("Invalid number of keyword arguments.")}checkApplyNumInputsRange(e,t,s){let i=e.args.length;if(i<t||i>s)throw new l.Error("Invalid number of arguments.");if(e.keywords.length>0)throw new l.Error("Invalid number of keyword arguments.")}validateAssignLhsExpr(e){let t=0,s=0;for(let i of e)if(i instanceof h.Name||i instanceof h.Subscript||i instanceof h.Tuple||i instanceof h.Attribute)t++;else if(i instanceof h.Starred)s++;else throw new l.Error("Assignment must be a variable, subscript, or starred expression.");if(s>1)throw new l.Error("Only one starred expression is allowed.");if(s>0&&t===0)throw new l.Error("Invalid starred expression.");return s}createTempName(e){return`${e}${this._temp_name_count++}`}handleMaybeNoReturn(e,t){let s=this._def_stack[this._def_stack.length-1]._declared_return_type;if(this.exit_blocks.size===0)throw s&&s!==r.NoneType.get()?new l.Error("Function was not annotated as having type None, but does not return along all paths."):(new r._C.WithInsertPoint(t.nodes()[-1]).dispose(),new Error);this._def_stack[this._def_stack.length-1]._merged_return_type===null&&(this._def_stack[this._def_stack.length-1]._merged_return_type=s===null?r.NoneType.get():s)}getAdjTupleIndex(e,t,s,i){let n=s,a=t.elements().length;if(s<0&&(n=a+s),!i&&(n>=a||n<0))throw new l.Error(`Tuple index out of range at ${e}.`);return n}emitTupleIndex(e,t,s){let i=t.type(),n=i.elements(),a=null;if(s.type()!==r.IntType.get())throw new l.Error("Tuple index must be an integer.");let o=r._C.toIValue(s);if(o){let c=this.getAdjTupleIndex(e,i,o.toInt(),!1);a=n[c]}else{if(n.length===0||!r._C.convertibleToList(i,r.ListType.create(n[0])))throw new l.Error("Cannot index into a tuple with a non-integer literal.");[a]=n}return this.graph.insertNode(this.graph.createTupleIndex(t,s,a)).output()}getSliceInd(e,t){let s=r._C.toIValue(e);if(s&&s.isInt())return s.toInt();throw new l.Error(`Tuple slice indices must be integer constants at '${t}'.`)}emitTupleSlice(e,t,s){let i=t.value(this.graph).type().expect(r.TupleType),n=i.elements().length,[a,o,c]=s,u=1;if(c){let g=r._C.toIValue(c.value(this.graph));r._C.TORCH_CHECK(g.isInt()),u=g.toInt()}let d={_:Number.MAX_SAFE_INTEGER};a&&(d={_:this.getAdjTupleIndex(e,i,this.getSliceInd(a.value(this.graph),e),!0)});let _={_:Number.MAX_SAFE_INTEGER};o&&(_={_:this.getAdjTupleIndex(e,i,this.getSliceInd(o.value(this.graph),e),!0)});let f=r._C.slice_indices_adjust(n,d,_,u);return this.graph.insertNode(this.graph.createTupleSlice(t.value(this.graph),d._,u,f)).output()}emitSliceOp(e,t,s,i,n,a){let o=[];if(o.push(new r._C.NamedValue(e,"self",t)),s?(r._C.AT_ASSERT(t.type().isSubtypeOf(r.TensorType.get())),o.emplace_back(new r._C.NamedValue(s))):r._C.AT_ASSERT(!t.type().isSubtypeOf(r.TensorType.get())),t.type()instanceof r.TupleType){let c=[];return c.push(i?new r._C.NamedValue(i):null),c.push(n?new r._C.NamedValue(n):null),c.push(a?new r._C.NamedValue(a):null),this.emitTupleSlice(e,o[0],c)}return a||(a=this.graph.insertConstant(1,e)),o.push(new r._C.NamedValue(e,"start",i)),o.push(new r._C.NamedValue(e,"end",n)),o.push(new r._C.NamedValue(e,"step",a)),this.emitBuiltinCall(e,this.graph,"aten::slice",o,[])}emitSlice(e,t,s,i){let n=null,a=null,o=null;return i.lower&&(n=this.emitExpr(i.lower)),i.upper&&(a=this.emitExpr(i.upper)),i.step&&(o=this.emitExpr(i.step)),this.emitSliceOp(e,t,s,n,a,o)}emitBasicSlice(e,t,s){r._C.AT_ASSERT(s instanceof h.Slice);let i=s,n=null;return t.type().isSubtypeOf(r.TensorType.get())&&(n=this.graph.insertConstant(0,e)),this.emitSlice(e,t,n,i)}emitSubscript(e,t){t=t===void 0?null:t;let s=this.emitSugaredExpr(e.value,1),i=e.slice,n=e.range(),a=e.value;if(i instanceof h.Tuple)return new r._C.SimpleValue(this.emitMultidimSlicing(n,s.asValue(a,this.method),i));if(i instanceof h.Slice){if(s.kind()==="module"){let d=s.asTupleValue(a,this.method).asValue(a,this.method),[_]=i,f=[];if(_.start().present()){let y=new r._C.NamedValue(a,"begin",this.emitExpr(_.start().get()));f.push(y)}else f.push(null);if(_.end().present()){let y=new r._C.NamedValue(a,"end",this.emitExpr(_.end().get()));f.push(y)}else f.push(null);if(_.step().present()){let y=new r._C.NamedValue(a,"step",this.emitExpr(_.step().get()));f.push(y)}else f.push(null);let g=this.emitTupleSlice(a,d,f);return new r._C.SimpleValue(g)}return new r._C.SimpleValue(this.emitBasicSlice(n,s.asValue(a,this.method),i))}let o=s.asValue(a,this.method),c=this.emitSugaredExpr(i,1);if(c instanceof r._C.SliceValue){let d=c,_=null;o.type().isSubtypeOf(r.TensorType.get())&&(_=this.method.graph().insertConstant(0,a));let f=this.emitSliceOp(a,o,_,d.start(),d.stop(),d.step());return new r._C.SimpleValue(f)}let u=c.asValue(a,this.method);return o.type()instanceof r.TupleType?new r._C.SimpleValue(this.emitTupleIndex(n,s.asValue(a,this.method),u)):o.type().isSubtypeOf(r.TensorType.get())?new r._C.SimpleValue(this.emitMultidimSlicing(n,o,i)):s.getitem(n,this.method,u,t)}}),this.registerType("torch.jit.CompilationUnit",class{constructor(){this._functions=new Map,this._classes=new Map}register_type(e){this._classes.set(e.annotation_str,e)}register_function(e){let t=e.qualname().qualifiedName();return r._C.TORCH_CHECK(!this._functions.has(t)),this._functions.set(t,e),e}define(...e){if(Array.isArray(e[1])){let[t,s,i,n,a,o,c,u]=e;r._C.TORCH_INTERNAL_ASSERT(n.length===a.length),r._C.TORCH_INTERNAL_ASSERT(s.length===i.length);let d=[],_=new Map,f=g=>{_.set(g.name(),g),d.push(g),this.register_function(g)};for(let g=0;g<s.length;g++){let y=this.define_property(t,s[g],i[g],o,_,c),x=y.getGetter(),F=y.getSetter();f(x),F&&f(F)}for(let g=0;g<n.length;g++){let y=this.define(t,n[g],a[g],o,_,c,"Method",u);f(y)}for(let[g,y]of _)g==="__init__"&&y.ensure_defined();for(let g of d)g.ensure_defined();return d}else if(e[1]instanceof h.FunctionDef){let[t,s,i,n,a,o,c,u]=e,d=n?i:new r._C.FunctionResolver(i,a),_=x=>new r._C.to_ir(s,d,n,x),f=t?new r._C.QualifiedName(t,s.name):new r._C.QualifiedName(s.name);o&&this.find_function(f)&&(f=this.mangle(f));let g=new r.Graph;g.set_op_version(u);let y=new r._C.GraphFunction(f,g,_);return y.__ast__=s,n&&(c==="hook"?n.getClassType().addForwardHook(y):c==="prehook"?n.getClassType().addPreHook(y):n.getClassType().addMethod(y)),y}throw new l.Error("Invalid arguments.")}get_type(e){return this._classes.get(e.qualifiedName())}get_class(e){return this.get_type(e)}find_function(e){let t=e.qualifiedName();return this._functions.get(t)}}),this.registerFunction("torch._C.ConvertToSSA",e=>{new r._C.ControlFlowLoadStores().run(e),new r._C.LoopContinuations().run(e),r._C.InlineLoopCondition(e),new r._C.EraseLoadStores().run(e),r._C.TransformExits(e)}),this.registerFunction("torch._C.canonicalizeModifiedLoop",()=>{}),this.registerFunction("torch._C.canonicalizeModifiedLoops",e=>{for(let t of e.nodes()){for(let s of t.blocks())r._C.canonicalizeModifiedLoops(s);t.kind()==="prim::Loop"&&r._C.canonicalizeModifiedLoop(t)}}),this.registerFunction("torch._C.CanonicalizeModifiedLoops",e=>{r._C.canonicalizeModifiedLoops(e.block())}),this.registerType("torch._C.MiniEnvironment",class{constructor(e,t){this.next=t||null,this.table=new Map}setVar(e,t){this.table.set(e,t)}definedVariables(){return Array.from(this.table.keys()).sort()}findInThisFrame(e){return this.table.has(e)?this.table.get(e):null}findInAnyFrame(e){let t=this;for(let s=t;s;s=s.next){let i=s.findInThisFrame(e);if(i)return i}return null}}),this.registerType("torch._C.ValueEnvironment",class extends r._C.MiniEnvironment{}),this.registerType("torch._C.TypeEnvironment",class extends r._C.MiniEnvironment{}),this.registerType("torch._C.ControlFlowLoadStores",class{constructor(){this.environment_stack=null}pushFrame(e){this.environment_stack=new r._C.TypeEnvironment(e,this.environment_stack)}popFrame(){let e=this.environment_stack;return this.environment_stack=this.environment_stack.next,e}addBlockInput(e,t,s){e.owningGraph().createStore(s,e.addInput(s).setType(t)).insertAfter(e.param_node())}addBlockOutput(e,t,s){let i=new r._C.WithInsertPoint(e),n=e.owningGraph(),a=n.insertNode(n.createLoad(s,t)).output();e.registerOutput(a),i.dispose()}addNodeOutput(e,t,s){let i=e.addOutput().setType(t);r._C.meaningfulName(s)&&i.setDebugName(s),e.owningGraph().createStore(s,i).insertAfter(e)}addNodeInput(e,t,s){let n=e.owningGraph().createLoad(s,t).insertBefore(e).output();e.addInput(n)}addIfLoadStores(e){let[t,s]=e.blocks(),i=this.addControlFlowLoadStores(t),n=this.addControlFlowLoadStores(s),a=new Set;for(let o of i.definedVariables())n.findInAnyFrame(o)&&a.add(o);for(let o of n.definedVariables())i.findInAnyFrame(o)&&a.add(o);for(let o of a){let c=i.findInAnyFrame(o),u=n.findInAnyFrame(o),d=r._C.unifyTypes(c,u,!0);this.addBlockOutput(t,c,o),this.addBlockOutput(s,u,o),this.addNodeOutput(e,d,o)}}addLoopLoadStores(e){let[t]=e.blocks(),s=this.addControlFlowLoadStores(t);for(let i of s.definedVariables()){let n=this.environment_stack.findInAnyFrame(i);if(!n)continue;let a=s.findInThisFrame(i),o=r._C.unifyTypes(n,a);this.addNodeInput(e,n,i),this.addBlockInput(t,o,i),this.addBlockOutput(t,a,i),this.addNodeOutput(e,o,i)}}addControlFlowLoadStores(e){this.pushFrame(e);for(let t of e.nodes())switch(t.kind()){case"prim::If":{this.addIfLoadStores(t);break}case"prim::Loop":{this.addLoopLoadStores(t);break}case"prim::Closure":{for(let s of t.blocks())this.addControlFlowLoadStores(s);break}case"prim::Store":{this.environment_stack.setVar(t.s("name"),t.input().type());break}case"prim::ComprehensionScope":{this.addControlFlowLoadStores(t.blocks()[0]);break}default:break}return this.popFrame()}run(e){this.addControlFlowLoadStores(e.block())}}),this.registerType("torch._C.LoopContinuations",class{constructor(){this._graph=null,this._false_val=null,this._curr_loop=null}assignExitContinuations(e){for(let t of e.nodes())switch(t.kind()){case"prim::If":{this.assignExitContinuations(t.blocks()[0]),this.assignExitContinuations(t.blocks()[1]);break}case"prim::Closure":{new r._C.LoopContinuations().run(t.blocks()[0]);break}case"prim::Loop":{let s=this._curr_loop;this._curr_loop=t,this.assignExitContinuations(t.blocks()[0]),this._curr_loop=s;break}case"prim::ContinueStmt":{let s=this._graph.create("prim::LoopContinuation",0).insertAfter(t),i=s.addBlock(),[,n]=this._curr_loop.blocks();i.cloneFrom(n,a=>a),this.InlineBlockBeforeNode(t,i),s.addInput(i.outputs()[0]),s.eraseBlock(0),this.addLoopCarriedOutputs(s),t.destroy();break}case"prim::BreakStmt":{let s=this._graph.create("prim::LoopContinuation",0).insertAfter(t);s.addInput(this._false_val),this.addLoopCarriedOutputs(s),t.destroy();break}default:break}}run(...e){if(e.length===1&&e[0]instanceof r.Graph){let[t]=e;this.run(t.block())}else if(e.length===1&&e[0]instanceof r.Block){let[t]=e;{this._graph=t.owningGraph();let s=new r._C.WithInsertPoint(t.nodes().front());this._false_val=this._graph.insertConstant(!1),s.dispose()}this.assignExitContinuations(t)}else throw new l.Error("Not implemented.")}}),this.registerType("torch._C.LoopView",class{constructor(e){r._C.AT_ASSERT(e.kind()==="prim::Loop"||e.kind()==="onnx::Loop"),this._node=e}bodyBlock(){return this._node.blocks()[0]}nextCond(){return this.bodyBlock().outputs()[0]}carriedOutputs(){return this._node.outputs()}bodyCarriedInputs(){return this.bodyBlock().inputs().slice(1)}bodyCarriedOutputs(){return this.bodyBlock().outputs().slice(1)}}),this.registerType("torch._C.WithLoopStatus",class{constructor(e,t){this._to_ir=e,this._prev=this._to_ir._loop_status,this._to_ir._loop_status=t}dispose(){this._to_ir._loop_status=this._prev}}),this.registerFunction("torch._C.InlineBlockBeforeNode",(e,t)=>{for(let s of t.nodes())s.moveBefore(e)}),this.registerFunction("torch._C.inlineLoopCondition",(...e)=>{if(e.length===1&&e[0]instanceof r.Block){let[t]=e;for(let s of t.nodes()){for(let i of s.blocks())r._C.inlineLoopCondition(i);s.kind()==="prim::Loop"&&r._C.inlineLoopCondition(s)}}else if(e.length===1&&e[0]instanceof r.Node){let[t]=e,[s,i]=t.blocks(),n=t.addBlock();n.cloneFrom(i,a=>a),r._C.InlineBlockBeforeNode(t,n),t.insertInput(1,n.outputs()[0]),t.eraseBlock(2),r._C.InlineBlockBeforeNode(s.return_node(),i),s.return_node().insertInput(0,i.outputs()[0]),t.eraseBlock(1)}else throw new l.Error("Not implemented.")}),this.registerFunction("torch._C.InlineLoopCondition",e=>{r._C.inlineLoopCondition(e.block())}),this.registerType("torch._C.EraseLoadStores",class{pushFrame(e){this.environment_stack=new r._C.ValueEnvironment(e,this.environment_stack)}popFrame(){let e=this.environment_stack;return this.environment_stack=this.environment_stack.next,e}eraseBlockLoadStores(e){this.pushFrame(e);for(let t of e.nodes())switch(t.kind()){case"prim::Store":{this.environment_stack.setVar(t.s("name"),t.input()),t.destroy();break}case"prim::Load":{let s=t.s("name"),i=this.environment_stack.findInAnyFrame(s);r._C.TORCH_INTERNAL_ASSERT(i),t.output().replaceAllUsesWith(i),t.destroy();break}case"prim::ComprehensionScope":{let[s]=t.blocks();this.eraseBlockLoadStores(s);for(let i of s.nodes())i.moveBefore(t);t.destroy();break}default:{for(let s of t.blocks())this.eraseBlockLoadStores(s);break}}this.popFrame()}run(e){this.eraseBlockLoadStores(e.block())}}),this.registerFunction("torch._C.convertEnterExitNodesToWithBlocks",()=>{}),this.registerFunction("torch._C.inlineConsecutiveIfs",()=>{}),this.registerType("torch._C.ExitPair",class{constructor(e,t){let s=[];for(let i of t)s.push(i);if(e.type()!==r.BoolType.get())throw new l.Error("Invalid exit value type.");this.first=e,this.second=s}hasExited(){return this.first}exitValues(){return this.second}}),this.registerType("torch._C.ExitTransformer",class{constructor(e){this._graph=e,this._target_block=null,this._unit_values=new Map;let t=new r._C.WithInsertPoint(this._graph.block().nodes().front());this._true_val=this._graph.insertConstant(!0),this._false_val=this._graph.insertConstant(!1),this._throws_val=this.getUnitValue(r.BoolType.get()),t.dispose()}getUnitValue(e){let t=this._unit_values.get(e);if(t)return t;let s=this._graph.createUninitialized(e).insertAfter(this._graph.param_node()).output();return this._unit_values.set(e,s),s}transformReturnStmts(){this._current_exit_kind="prim::ReturnStmt",this.transformExits(this._graph.block())}transformLoopContinuations(){this._current_exit_kind="prim::LoopContinuation",this.transformExits(this._graph.block())}destroyNodeAfterExit(e){for(let t of e.outputs())t.uses().length>0&&t.replaceAllUsesWith(this.getUnitValue(t.type()));e.destroy()}deleteAfterExitNodes(e,t){let s=e.nodes();if(t===s.end())return;let i=new r._C.WithInsertPoint(e.nodes().front());for(let n of Array.from(s).reverse()){if(n===t)break;n!==e.return_node()&&this.destroyNodeAfterExit(n)}this.destroyNodeAfterExit(t),i.dispose()}updateTargetBlock(e){r._C.ExitTransformer.owningNodeKind(e)==="prim::Loop"&&this._current_exit_kind==="prim::LoopContinuation"?this._target_block=e:r._C.ExitTransformer.isGraphOrClosureBlock(e)&&this._current_exit_kind==="prim::ReturnStmt"&&(this._target_block=e)}transformLoop(e){let t=new r._C.LoopView(e),s=t.bodyBlock(),i=this.transformExits(s);if(this.getExitStatus(i)==="WONT"||this.getExitStatus(i)==="THROWS")return this.constructWontExitPair();let n=new r._C.WithInsertPoint(s),a=this._graph.insertNode(this._graph.create("prim::If",0));a.addInput(i.hasExited()),a.addBlock().registerOutput(this._false_val),a.addBlock().registerOutput(t.nextCond());let o=a.addOutput().setType(r.BoolType.get());t.bodyBlock().eraseOutput(0),t.bodyBlock().insertOutput(0,o),e.addInput(this._false_val),s.addInput().setType(r.BoolType.get()),s.registerOutput(i.hasExited());let c=e.addOutput().setType(r.BoolType.get());for(let _ of i.exitValues()){let f=_.type();e.addInput(this.getUnitValue(f)),e.addOutput().setType(f),s.addInput().setType(f),s.registerOutput(_)}let u=e.outputs().slice(e.outputs().length-i.exitValues().size()),d=new r._C.ExitPair(c,u);return n.dispose(),d}calcIfExitStatus(e,t){return e==="THROWS"?t:t==="THROWS"?e:e==="WONT"&&t==="WONT"?"WONT":e==="WILL"&&t==="WILL"?"WILL":"MIGHT"}transformIf(e){let[t,s]=e.blocks(),i=this.transformExits(t),n=this.transformExits(s),a=this.getExitStatus(i),o=this.getExitStatus(n),c=this.calcIfExitStatus(a,o);if(c==="THROWS")return this.constructThrowsExitPair();if(c==="WONT")return this.constructWontExitPair();if(a==="WONT"||a==="THROWS"){let f=this.matchValuesWithUnitialized(n.exitValues());i=new r._C.ExitPair(i.hasExited(),f)}else if(o==="WONT"||o==="THROWS"){let f=this.matchValuesWithUnitialized(i.exitValues());n=new r._C.ExitPair(n.hasExited(),f)}let u=null;c==="WILL"?u=this._true_val:(this.addIfOutputs(e,[i.hasExited()],[n.hasExited()]),u=e.outputs().at(e.outputs().length-1)),this.addIfOutputs(e,i.exitValues(),n.exitValues());let d=i.exitValues().size(),_=e.outputs().slice(e.outputs().length-d);return new r._C.ExitPair(u,_)}transformExits(e){let t=this._target_block;this.updateTargetBlock(e);let s=this.constructWontExitPair();for(let i of e.nodes()){let n=i.next;switch(i.kind()){case"prim::RaiseException":{s=this.constructThrowsExitPair();break}case"prim::ReturnStmt":case"prim::LoopContinuation":{i.kind()===this._current_exit_kind&&(s=this.constructWillExitPair(i.inputs()),i.destroy());break}case"prim::If":{s=this.transformIf(i);break}case"prim::With":{s=this.transformWith(i);break}case"prim::Closure":{this.transformExits(i.blocks()[0]);break}case"prim::Loop":{s=this.transformLoop(i);break}default:break}let a=this.getExitStatus(s);if(a==="WILL"||a==="THROWS"){this.deleteAfterExitNodes(e,n);break}if(a==="MIGHT")throw new l.Error("Not implemented.")}if(this._target_block===e){if(this.getExitStatus(s)==="MIGHT"){let i=this._graph.create("prim::If",0).insertBefore(e.return_node());i.addBlock(),i.addBlock(),i.addInput(s.hasExited()),r._C.ExistTransformer.addIfOutputs(i,s.exitValues(),e.outputs()),r._C.ExistTransformer.replaceBlockOutputs(e,i.soutputs())}else this.getExitStatus(s)==="WILL"&&r._C.ExitTransformer.replaceBlockOutputs(e,s.exitValues());s=this.constructWontExitPair()}return this._target_block=t,s}constructThrowsExitPair(){return new r._C.ExitPair(this._throws_val,[])}constructWontExitPair(){return new r._C.ExitPair(this._false_val,[])}constructWillExitPair(e){return new r._C.ExitPair(this._true_val,e)}getExitStatus(e){let t=e.hasExited();return t===this._true_val?"WILL":t===this._false_val?"WONT":t===this._throws_val?"THROWS":"MIGHT"}static owningNodeKind(e){return e.owningNode()?e.owningNode().kind():null}static isGraphOrClosureBlock(e){return e.owningNode()===null||r._C.ExitTransformer.owningNodeKind(e)==="prim::Closure"}static removeOutputs(e){for(;e.outputs().length>0;)e.eraseOutput(0)}static registerBlockOutputs(e,t){for(let s of t)e.registerOutput(s)}static replaceBlockOutputs(e,t){r._C.ExitTransformer.removeOutputs(e),r._C.ExitTransformer.registerBlockOutputs(e,t)}}),this.registerFunction("torch._C.convertWithBlocksToEnterExitNodes",()=>{}),this.registerFunction("torch._C.TransformExits",e=>{r._C.convertEnterExitNodesToWithBlocks(e),new r._C.ExitTransformer(e).transformLoopContinuations(),new r._C.ExitTransformer(e).transformReturnStmts(),r._C.inlineConsecutiveIfs(e.block()),r._C.convertWithBlocksToEnterExitNodes(e)}),this.registerFunction("torch._C.normalizeRSub",e=>{if(e.kind()==="aten::rsub"&&e.schema()&&e.schema().overload==="Tensor"){let t=e.inputs(),s=e.replaceWithNewSymbol("aten::sub");return s.replaceInput(0,t[1]),s.replaceInput(1,t[0]),e.destroyCurrent(),!0}return!1}),this.registerFunction("torch._C.normalizeOpAliases",()=>{}),this.registerFunction("torch._C.normalizeIsBool",e=>{let t=e.inputs();if(t.length===2&&t[0].type()===r.BoolType.get()&&t[1].type()===r.BoolType.get()){if(e.kind()==="aten::__is__")return e.replaceWithNewSymbol("aten::eq"),e.destroyCurrent(),!0;if(e.kind()==="aten::__isnot__")return e.replaceWithNewSymbol("aten::ne"),e.destroyCurrent(),!0}return!1}),this.registerFunction("torch._C.NormalizeOps",e=>{for(let t of e.nodes()){for(let s of t.blocks())r._C.NormalizeOps(s);r._C.normalizeRSub(t)||r._C.normalizeOpAliases(t)||r._C.normalizeIsBool(t)}}),this.registerFunction("torch._C.getInlineEverythingMode",()=>!1),this.registerFunction("torch._C.runCleanupPasses",e=>{r._C.getInlineEverythingMode()&&r._C.Inline(e),r._C.LowerSimpleTuples(e),r._C.ConstantPropagationImmutableTypes(e),r._C.ConstantPooling(e)}),this.registerType("torch.jit._script.ScriptModule",class extends r.nn.modules.module.Module{}),this.registerType("torch.jit._trace.TracedModule",class extends r.jit._script.ScriptModule{}),this.registerType("torch.jit._trace.TopLevelTracedModule",class extends r.jit._trace.TracedModule{}),this.registerType("torch.jit._script.RecursiveScriptModule",class extends r.jit._script.ScriptModule{constructor(e){super(),this._initializing=!0,this._c=e}static _construct(e,t){let s=new r.jit._script.RecursiveScriptModule(e);return t(s),r.jit._script.RecursiveScriptModule._finalize_scriptmodule(s),s}static _finalize_scriptmodule(e){e._parameters=new r.ParameterDict(e._c).items(),e._buffers=new r.BufferDict(e._c).items(),e._initializing=!1}get graph(){return this._c.graph}get code_with_constants(){return this._c.code_with_constants}__setattr__(e,t){this._initializing?super.__setattr__(e,t):this._modules.has(e)?this._modules.set(e,t):this._c.hasattr(e)&&this._c.setattr(e,t)}__getattr__(e){return this._initializing?super.__getattr__(e):this._modules.has(e)?this._modules.get(e):this._c.hasattr(e)?this._c.getattr(e):(this._c._has_method(e),super.__getattr__(e))}}),r.jit.ScriptModule=r.jit._script.ScriptModule,r.jit.RecursiveScriptModule=r.jit._script.RecursiveScriptModule,r.jit.TopLevelTracedModule=r.jit._trace.TopLevelTracedModule,r.CompilationUnit=r.jit.CompilationUnit,r._C.CompilationUnit=r.jit.CompilationUnit,r._C.ScriptModule=r.ScriptModule,r._C.ClassType=r.ClassType,this.registerType("torch._C.FlatBuffersLoader",class{constructor(e){this._cu=e;let t=e.execution.__import__("torch");this._torch=t;let s=Array.from(new Set(Object.values(t).filter(i=>i instanceof t.dtype)));this._dtypes=new Map(s.map(i=>[i.scalar_type(),i])),this._ivalue_parsers=new Map,this._ivalue_parsers.set(t.mobile.serialization.Int,i=>i.val.int_val),this._ivalue_parsers.set(t.mobile.serialization.Bool,i=>i.val.bool_val),this._ivalue_parsers.set(t.mobile.serialization.Double,i=>i.val.double_val),this._ivalue_parsers.set(t.mobile.serialization.TensorMetadata,i=>this.parseTensor(i)),this._ivalue_parsers.set(t.mobile.serialization.Object,i=>this.parseObject(i))}parseModule(e){this._module=e,this._all_functions=new Map,this._all_ivalues=new Array(e.ivalues.length),this._all_types=new Array(e.object_types.length);let t=e.mobile_ivalue_size?e.mobile_ivalue_size:e.ivalues.length;for(let i=0;i<t;i++)this.parseAndPopulate(i,e.ivalues[i]);let s=this._all_ivalues[e.state_obj];for(let[i,n]of this._all_functions){let a=e.ivalues[i].val.class_type,o=this._all_types[a];n&&o.addMethod(n)}return s._min_operator_version=e.operator_version,s._bytecode_version=e.bytecode_version,s}parseAndPopulate(e,t){t.val instanceof r.mobile.serialization.Function?this._all_functions.set(e,this.parseFunction(t.val)):this._all_ivalues[e]=this.parseIValue(t)}parseFunction(){return null}parseIValue(e){return e.val?this._ivalue_parsers.get(e.val.constructor)(e):null}parseTensor(e){return this.parseTensorFromMetadata(e.val)}parseTensorFromMetadata(e){if(e.quantized_schema)throw new r.Error("Quantized schema not implemented.");let t=e.storage_location_index,s=this._module.storage_data[t].data,i=this._dtypes.get(e.scalar_type),n=s.length/i.itemsize(),a=this._cu.execution.invoke("torch.storage.TypedStorage",[n,i]);a._set_cdata(s);let o=this._cu.execution.invoke("torch.Tensor",[]),c=Array.from(e.sizes),u=Array.from(e.strides);return o.__setstate__([a,e.storage_offset,c,u]),o}parseObject(e){let t=e.val,s=this._module.object_types[t.type_index],i=this.getOrCreateClassTypeForObject(t);switch(s.type){case r.mobile.serialization.TypeType.CLASS_WITH_FIELD:{let a=this._torch.ScriptObject.create(i);for(let o=0;o<t.attrs.length;o++){let c=s.attr_names[o],u=this._all_ivalues[t.attrs[o]];a.__setattr__(c,u)}return a}case r.mobile.serialization.TypeType.CUSTOM_CLASS:case r.mobile.serialization.TypeType.CLASS_WITH_SETSTATE:default:throw new l.Error(`Unknown object type type '${s.type}'.`)}}getOrCreateClassTypeForObject(e){let t=this._all_types[e.type_index],s=this._module.object_types[e.type_index];if(!t){let i=s.type_name;if((i.startsWith("__torch__")||i.startsWith("torch.jit"))&&(t=this._cu.get_class(new r._C.QualifiedName(i)),t||(t=this._torch.ClassType.create(i,this._cu,!0),this._cu.register_type(t))),this._all_types[e.type_index]=t,s.type===r.mobile.serialization.TypeType.CLASS_WITH_FIELD)for(let n=0;n<e.attrs.length;n++)t.addAttribute(s.attr_names[n])}return t}}),this.registerType("torch.export.UnflattenedModule",class extends r.nn.modules.module.Module{constructor(e,t){super();let s=N.deepcopy(e.graph);m.graph_signature=N.deepcopy(e.graph_signature),this.graph=r.fx.Graph(),this.graph.owning_module=this,this.module_call_graph=N.deepcopy(e.module_call_graph),this.flat_args_adapter=t,this.adapted=!1,this._inplace_buffer_mutations(s,this.graph_signature)}}),this.registerType("torch.export.graph_signature.ExportGraphSignature",class{constructor(e,t){this.input_specs=e,this.output_specs=t}user_inputs(){let e=[];for(let t of this.input_specs)if(t.kind===r.export.graph_signature.InputKind.USER_INPUT)if(t.arg instanceof r.export.graph_signature.TensorArgument||t.arg instanceof r.export.graph_signature.SymIntArgument||t.arg instanceof r.export.graph_signature.CustomObjArgument)e.push(t.arg.name);else if(t.arg instanceof r.export.graph_signature.ConstantArgument)e.push(t.arg.value);else throw new l.Error(`Unsupported user input '${t.arg}'.`);return e}user_outputs(){let e=[];for(let t of this.output_specs)if(t.kind===r.export.graph_signature.OutputKind.USER_OUTPUT)if(t.arg instanceof r.export.graph_signature.TensorArgument||t.arg instanceof r.export.graph_signature.SymIntArgument||t.arg instanceof r.export.graph_signature.CustomObjArgument)e.push(t.arg.name);else if(t.arg instanceof r.export.graph_signature.ConstantArgument)e.push(t.arg.value);else throw new l.Error(`Unsupported user output '${t.arg}'.`);return e}inputs_to_parameters(){return new Map(this.input_specs.filter(e=>e.kind===r.export.graph_signature.InputKind.PARAMETER&&e.arg instanceof r.export.graph_signature.TensorArgument&&typeof e.target=="string").map(e=>[e.arg.name,e.target]))}inputs_to_buffers(){return new Map(this.input_specs.filter(e=>e.kind===r.export.graph_signature.InputKind.BUFFER&&e.arg instanceof r.export.graph_signature.TensorArgument&&typeof e.target=="string").map(e=>[e.arg.name,e.target]))}inputs_to_lifted_tensor_constants(){return new Map(this.input_specs.filter(e=>e.kind===r.export.graph_signature.InputKind.CONSTANT_TENSOR&&e.arg instanceof r.export.graph_signature.TensorArgument&&typeof e.target=="string").map(e=>[e.arg.name,e.target]))}}),r.export.graph_signature.InputKind={USER_INPUT:0,PARAMETER:1,BUFFER:2,CONSTANT_TENSOR:3,CUSTOM_OBJ:4,TOKEN:5},this.registerType("torch.export.graph_signature.InputSpec",class{constructor(e,t,s,i){this.kind=e,this.arg=t,this.target=s,this.persistent=i||null}}),r.export.graph_signature.OutputKind={USER_OUTPUT:0,LOSS_OUTPUT:1,BUFFER_MUTATION:2,GRADIENT_TO_PARAMETER:3,GRADIENT_TO_USER_INPUT:4,USER_INPUT_MUTATION:5,TOKEN:6},this.registerType("torch.export.graph_signature.OutputSpec",class{constructor(e,t,s){this.kind=e,this.arg=t,this.target=s}}),this.registerType("torch.export.graph_signature.ConstantArgument",class{constructor(e,t){this.name=e,this.value=t}}),this.registerType("torch.export.graph_signature.TensorArgument",class{constructor(e){this.name=e}}),this.registerType("torch.export.graph_signature.SymIntArgument",class{constructor(e){this.name=e}}),this.registerType("torch.export.graph_signature.CustomObjArgument",class{constructor(e,t,s){this.name=e,this.class_fqn=t,this.fake_val=s}}),this.registerType("torch.export.exported_program.ExportedProgram",class{constructor(e,t,s,i,n,a,o,c,u,d){this._graph_module=this._create_graph_module_for_export(e,t),e instanceof r.fx.GraphModule,this._graph_signature=s,this._state_dict=i,this._range_constraints=n,this._module_call_graph=a,this._example_inputs=o,this._constants=u||d||{}}_create_graph_module_for_export(e,t){let s=null;try{s=new r.fx.GraphModule(e,t)}catch{let i=new r.fx.GraphModule(e,r.fx.Graph());i._graph=t}return s}get graph_module(){return this._graph_module}get graph(){return this._graph_module.graph}get graph_signature(){return this._graph_signature}get state_dict(){return this._state_dict}get constants(){return this._constants}}),this.registerType("torch.export.exported_program.ModuleCallEntry",class{}),this.registerType("torch.export.exported_program.ModuleCallSignature",class{}),this.registerFunction("torch.export.unflatten",(e,t)=>(e=r.export._remove_effect_tokens(e),new r.export.UnflattenedModule(e,t))),this.registerFunction("torch._export.exported_program._create_graph_module_for_export",(e,t)=>new r.fx.graph_module.GraphModule(e,t)),this.registerType("torch._export.serde.serialize.SerializedArtifact",class{constructor(e,t,s,i){this.exported_program=e,this.state_dict=t,this.constants=s,this.example_inputs=i}}),r._export.serde.serialize._SYM_INT_OPS=new Set([k.mul,k.add,k.sub,k.floordiv,k.mod,r.sym_sqrt,r.sym_int,r.sym_ite,r.sym_max,r.sym_min,r.sym_sqrt]),r._export.serde.serialize._SYM_BOOL_OPS=new Set([k.eq,k.ne,k.le,k.ge,k.lt,k.gt,r.sym_not]),this.registerType("torch._export.serde.union._Union",class{constructor(e){if(e.$type)this.type=e.$type,this[e.$type]=e.$value,delete e.$type,delete e.$value;else{let t=Object.entries(e);if(t.length>1&&(t=t.filter(([,a])=>a!==null)),t.length!==1)throw new Error;let[s]=t,[i,n]=s;this.type=i,this[i]=n}}get value(){return this[this.type]}}),this.registerType("torch._export.serde.schema.NamedArgument",class{constructor(e){this.arg=new r._export.serde.schema.Argument(e.arg),this.name=e.name}}),this.registerType("torch._export.serde.schema.Argument",class extends r._export.serde.union._Union{constructor(e){if(super(e),!(this.type==="as_int"||this.type==="as_ints"||this.type==="as_float"||this.type==="as_floats"||this.type==="as_bool"||this.type==="as_bools"||this.type==="as_string"||this.type==="as_strings"||this.type==="as_scalar_type"||this.type==="as_device"||this.type==="as_memory_format"||this.type==="as_layout"))if(this.type==="as_none")this.as_none=null;else if(this.type==="as_tensor")this.as_tensor=new r._export.serde.schema.TensorArgument(this.as_tensor);else if(this.type==="as_tensors")this.as_tensors=this.as_tensors.map(t=>new r._export.serde.schema.TensorArgument(t));else if(this.type==="as_graph")this.as_graph=new r._export.serde.schema.GraphArgument(this.as_graph);else if(this.type==="as_sym_int")this.as_sym_int=new r._export.serde.schema.SymIntArgument(this.as_sym_int);else if(this.type==="as_sym_ints")this.as_sym_ints=this.as_sym_ints.map(t=>new r._export.serde.schema.SymIntArgument(t));else if(this.type==="as_sym_bool")this.as_sym_bool=new r._export.serde.schema.SymBoolArgument(this.as_sym_bool);else if(this.type==="as_sym_bools")this.as_sym_bools=this.as_sym_bools.map(t=>new r._export.serde.schema.SymBoolArgument(t));else if(this.type==="as_optional_tensors")this.as_optional_tensors=this.as_optional_tensors.map(t=>new r._export.serde.schema.OptionalTensorArgument(t));else throw new l.Error(`Unsupported argument '${this.type}'.`)}}),this.registerType("torch._export.serde.schema.Node",class{constructor(e){this.target=e.target,this.inputs=e.inputs.map(t=>new r._export.serde.schema.NamedArgument(t)),this.outputs=e.outputs.map(t=>new r._export.serde.schema.Argument(t)),this.metadata=new Map(Object.entries(e.metadata))}}),r._export.serde.schema.ScalarType={UNKNOWN:0,BYTE:1,CHAR:2,SHORT:3,INT:4,LONG:5,HALF:6,FLOAT:7,DOUBLE:8,COMPLEXHALF:9,COMPLEXFLOAT:10,COMPLEXDOUBLE:11,BOOL:12,BFLOAT16:13},r._export.serde.schema.Layout={Unknown:0,SparseCoo:1,SparseCsr:2,SparseCsc:3,SparseBsr:4,SparseBsc:5,_mkldnn:6,Strided:7},r._export.serde.schema.MemoryFormat={Unknown:0,ContiguousFormat:1,ChannelsLast:2,ChannelsLast3d:3,PreserveFormat:4},this.registerType("torch._export.serde.schema.Device",class{constructor(e){Object.assign(this,W({},e))}}),this.registerType("torch._export.serde.schema.TensorMeta",class{constructor(e){e=e.meta||e,this.dtype=e.dtype,this.sizes=e.sizes.map(t=>new r._export.serde.schema.SymInt(t)),this.requires_grad=e.requires_grad,this.device=e.device,this.strides=e.strides.map(t=>new r._export.serde.schema.SymInt(t)),this.storage_offset=new r._export.serde.schema.SymInt(Number.isInteger(e.storage_offset)?{as_int:e.storage_offset}:e.storage_offset),this.layout=e.layout}}),this.registerType("torch._export.serde.schema.Graph",class{constructor(e){this.inputs=e.inputs.map(t=>new r._export.serde.schema.Argument(t)),this.outputs=e.outputs.map(t=>new r._export.serde.schema.Argument(t)),this.nodes=e.nodes.map(t=>new r._export.serde.schema.Node(t)),this.tensor_values=new Map(Object.entries(e.tensor_values).map(([t,s])=>[t,new r._export.serde.schema.TensorMeta(s)])),this.sym_int_values=new Map(Object.entries(e.sym_int_values).map(([t,s])=>[t,new r._export.serde.schema.SymInt(s)])),this.sym_bool_values=new Map(Object.entries(e.sym_bool_values).map(([t,s])=>[t,new r._export.serde.schema.SymBool(s)])),this.is_single_tensor_return=e.is_single_tensor_return,this.custom_obj_values=new Map(Object.entries(e.custom_obj_values||{}).map(([t,s])=>[t,new r._export.serde.schema.CustomObjArgument(s)])),e.contants}}),this.registerType("torch._export.serde.schema.ModuleCallSignature",class{constructor(e){Object.assign(this,W({},e)),this.inputs=this.inputs.map(t=>new r._export.serde.schema.Argument(t)),this.outputs=this.outputs.map(t=>new r._export.serde.schema.Argument(t))}}),this.registerType("torch._export.serde.schema.ModuleCallEntry",class{constructor(e){Object.assign(this,W({},e)),this.signature=this.signature?new r._export.serde.schema.ModuleCallSignature(this.signature):null}}),this.registerType("torch._export.serde.schema.GraphModule",class{constructor(e){this.graph=new r._export.serde.schema.Graph(e.graph),this.signature=new r._export.serde.schema.GraphSignature(e.signature),this.module_call_graph=e.module_call_graph.map(t=>new r._export.serde.schema.ModuleCallEntry(t)),this.metadata=new Map(Object.entries(e.metadata||{}))}}),this.registerType("torch._export.serde.schema.ExportedProgram",class{constructor(e){Object.assign(this,W({},e)),this.graph_module=new r._export.serde.schema.GraphModule(e.graph_module)}}),this.registerType("torch._export.serde.schema.SymExprHint",class extends r._export.serde.union._Union{}),this.registerType("torch._export.serde.schema.SymExpr",class{constructor(e){this.expr_str=e.expr_str,this.hint=e.hint?new r._export.serde.schema.SymExprHint(e.hint):null}}),this.registerType("torch._export.serde.schema.SymInt",class extends r._export.serde.union._Union{constructor(e){if(super(e),this.type!=="as_int")if(this.type==="as_expr")this.as_expr=new r._export.serde.schema.SymExpr(this.as_expr);else throw new l.Error(`Unsupported symbolic int '${this.type}'.`)}}),this.registerType("torch._export.serde.schema.SymIntArgument",class extends r._export.serde.union._Union{constructor(e){super(e),Object.assign(this,W({},e))}}),this.registerType("torch._export.serde.schema.SymBool",class extends r._export.serde.union._Union{constructor(e){if(super(e),this.type!=="as_bool")if(this.type==="as_expr")this.as_expr=new r._export.serde.schema.SymExpr(this.as_expr);else throw new l.Error(`Unsupported symbolic bool '${this.type}'.`)}}),this.registerType("torch._export.serde.schema.SymBoolArgument",class extends r._export.serde.union._Union{constructor(e){super(e),Object.assign(this,W({},e))}}),this.registerType("torch._export.serde.schema.GraphSignature",class{constructor(e){if(this.input_specs=[],Array.isArray(e.input_specs)&&(this.input_specs=e.input_specs.map(t=>new r._export.serde.schema.InputSpec(t))),Array.isArray(e.user_inputs))for(let t of e.user_inputs)this.input_specs.push(new r._export.serde.schema.InputSpec({user_input:{arg:{as_string:t}}}));if(e.inputs_to_parameters)for(let[t,s]of Object.entries(e.inputs_to_parameters))this.input_specs.push(new r._export.serde.schema.InputSpec({parameter:{arg:{name:t},parameter_name:s}}));this.output_specs=[],Array.isArray(e.output_specs)&&(this.output_specs=e.output_specs.map(t=>new r._export.serde.schema.OutputSpec(t)))}}),this.registerType("torch._export.serde.schema.UserInputSpec",class{constructor(e){this.arg=new r._export.serde.schema.Argument(e.arg)}}),this.registerType("torch._export.serde.schema.InputToParameterSpec",class{constructor(e){this.arg=new r._export.serde.schema.TensorArgument(e.arg),this.parameter_name=e.parameter_name}}),this.registerType("torch._export.serde.schema.InputToBufferSpec",class{constructor(e){this.arg=new r._export.serde.schema.TensorArgument(e.arg),this.buffer_name=e.buffer_name}}),this.registerType("torch._export.serde.schema.InputToTensorConstantSpec",class{constructor(e){this.arg=new r._export.serde.schema.TensorArgument(e.arg),this.tensor_constant_name=e.tensor_constant_name}}),this.registerType("torch._export.serde.schema.InputToConstantInputSpec",class{constructor(e){this.name=e.name,this.value=new r._export.serde.schema.ConstantValue(e.value)}}),this.registerType("torch._export.serde.schema.ConstantValue",class extends r._export.serde.union._Union{constructor(e){if(super(e),!(this.type==="as_int"||this.type==="as_float"||this.type==="as_bool"||this.type==="as_string"||this.type==="as_strings"))if(this.type==="as_none")this.as_none=null;else throw new l.Error(`Unsupported constant value type '${this.type}'.`)}}),this.registerType("torch._export.serde.schema.InputSpec",class extends r._export.serde.union._Union{constructor(e){if(super(e),this.type==="user_input")this.user_input=new r._export.serde.schema.UserInputSpec(this.user_input);else if(this.type==="parameter")this.parameter=new r._export.serde.schema.InputToParameterSpec(this.parameter);else if(this.type==="buffer")this.buffer=new r._export.serde.schema.InputToBufferSpec(this.buffer);else if(this.type==="tensor_constant")this.tensor_constant=new r._export.serde.schema.InputToTensorConstantSpec(this.tensor_constant);else if(this.type==="constant_input")this.constant_input=new r._export.serde.schema.InputToConstantInputSpec(this.constant_input);else throw new l.Error(`Unsupported input spec type '${this.type}'.`)}}),this.registerType("torch._export.serde.schema.UserOutputSpec",class{constructor(e){this.arg=new r._export.serde.schema.Argument(e.arg)}}),this.registerType("torch._export.serde.schema.BufferMutationSpec",class{constructor(e){this.arg=new r._export.serde.schema.TensorArgument(e.arg),this.buffer_name=e.buffer_name}}),this.registerType("torch._export.serde.schema.GradientToParameterSpec",class{constructor(e){this.arg=new r._export.serde.schema.Argument(e.arg),this.parameter_name=e.parameter_name}}),this.registerType("torch._export.serde.schema.GradientToUserInputSpec",class{constructor(e){this.arg=new r._export.serde.schema.Argument(e.arg),this.user_input_name=e.user_input_name}}),this.registerType("torch._export.serde.schema.UserInputMutationSpec",class{constructor(e){this.arg=new r._export.serde.schema.Argument(e.arg),this.user_input_name=e.user_input_name}}),this.registerType("torch._export.serde.schema.OutputTokenSpec",class{constructor(e){this.arg=new r._export.serde.schema.TokenArgument(e.arg)}}),this.registerType("torch._export.serde.schema.OutputSpec",class extends r._export.serde.union._Union{constructor(e){super(e),this.type==="user_output"?this.user_output=new r._export.serde.schema.UserOutputSpec(this.user_output):this.type==="loss_output"?this.loss_output=new r._export.serde.schema.LossOutputSpec(this.loss_output):this.type==="buffer_mutation"?this.buffer_mutation=new r._export.serde.schema.BufferMutationSpec(this.buffer_mutation):this.type==="gradient_to_parameter"?this.gradient_to_parameter=new r._export.serde.schema.GradientToParameterSpec(this.gradient_to_parameter):this.type==="gradient_to_user_input"?this.gradient_to_user_input=new r._export.serde.schema.GradientToUserInputSpec(this.gradient_to_user_input):this.type==="user_input_mutation"?this.user_input_mutation=new r._export.serde.schema.UserInputMutationSpec(this.user_input_mutation):this.type==="token"&&(this.token=new r._export.serde.schema.OutputTokenSpec(this.token))}}),this.registerType("torch._export.serde.schema.TensorArgument",class{constructor(e){this.name=e.name}}),this.registerType("torch._export.serde.schema.TokenArgument",class{constructor(e){this.name=e.name}}),this.registerType("torch._export.serde.schema.GraphArgument",class{constructor(e){this.name=e.name,this.graph=new r._export.serde.schema.Graph(e.graph)}}),this.registerType("torch._export.serde.schema.OptionalTensorArgument",class extends r._export.serde.union._Union{constructor(e){if(super(e),this.type==="as_tensor")this.as_tensor=new r._export.serde.schema.TensorArgument({name:this.as_tensor});else if(this.type==="as_none")this.as_none=null;else throw new l.Error(`Unsupported optional tensor argument '${this.type}'.`)}}),this.registerFunction("torch.export.pt2_archive._package.load_pt2",(e,t)=>{let s=new Map;for(let i of e.keys()){let n=i.match(/^models\/([^/]+)\.json$/);if(n){let[,a]=n,o=e.get(`models/${a}.json`),c=e.get(`data/weights/${a}.pt`),u=e.get(`data/constants/${a}.pt`),d=e.get(`data/sample_inputs/${a}.pt`),_=new r._export.serde.serialize.SerializedArtifact(o,c,u,d),f=r._export.serde.serialize.deserialize(_,t);s.set(a,f)}}return{exported_programs:s}}),this.registerFunction("torch._export.serde.serialize._dict_to_dataclass",(e,t)=>{if(t===null)return t;if(e)return new e(t);throw new l.Error(`Unsupported data class '${e.__name__}'.`)}),this.registerFunction("torch._export.serde.serialize.deserialize",(e,t)=>{let s=r._export.serde.serialize._dict_to_dataclass(r._export.serde.schema.ExportedProgram,e.exported_program);return new r._export.serde.serialize.ExportedProgramDeserializer(t).deserialize(s,e.state_dict,e.constants,e.example_inputs)}),this.registerType("torch._export.serde.serialize.ExportedProgramDeserializer",class{constructor(e){this.expected_opset_version=e}deserialize(e,t,s,i){let n=new Map(Object.entries(e.range_constraints)),o=new r._export.serde.serialize.GraphModuleDeserializer().deserialize(e.graph_module,t,s,i,n),c=null;return new r.export.exported_program.ExportedProgram(o.graph_module,o.graph_module.graph,o.signature,o.state_dict,c,o.module_call_graph,o.example_inputs,null,o.constants)}}),this.registerFunction("torch._export.serde.serialize.deserialize_torch_artifact",e=>e?r.load(e):new T.dict),this.registerType("torch._export.serde.serialize.GraphModuleDeserializer",class{constructor(){this.serialized_name_to_node=new Map,this.serialized_name_to_meta=new Map,this.graph=new r.fx.Graph,this.module=new r.nn.Module}deserialize_graph_output(e){if(e.type==="as_tensor")return this.serialized_name_to_node.get(e.as_tensor.name);if(e.type==="as_sym_int")return this.serialized_name_to_node.get(e.as_sym_int.as_name);if(e.type==="as_sym_bool")return this.serialized_name_to_node.get(e.as_sym_bool.as_name);if(e.type==="as_int")return this.serialized_name_to_node.get(e.as_int.as_name);if(e.type==="as_none")return this.serialized_name_to_node.get(e.as_sym_bool.as_name);throw new l.Error(`Unsupported graph node ${e.type}.`)}deserialize_graph(e){for(let[i,n]of e.tensor_values){let a=this.deserialize_tensor_meta(n.meta||n,this.fake_tensor_mode);this.serialized_name_to_meta.set(i,a)}for(let[i,n]of e.sym_int_values)this.serialized_name_to_meta.set(i,this.deserialize_sym_int(n));for(let[i,n]of e.sym_bool_values)this.serialized_name_to_meta.set(i,this.deserialize_sym_bool(n));for(let[i,n]of e.custom_obj_values)this.serialized_name_to_meta.set(i,this.deserialize_script_obj_meta(n));for(let i=0;i<e.inputs.length;i++){let n=e.inputs[i];if(n.type==="as_tensor"||n.type==="as_sym_int"||n.type==="as_custom_obj"){let a=n.value.name,o=this.graph.placeholder(a);o.name=a,this.sync_fx_node(a,o)}else if(n.type==="as_int"||n.type==="as_float"||n.type==="as_bool"||n.type==="as_none"||n.type==="as_string"){let a=this.signature.input_specs[i].arg.name;this.graph.placeholder(a).meta.set("val",this.deserialize_input(n))}else throw new l.Error(`Invalid input ${n.type}.`)}for(let i of e.nodes){let n=this.deserialize_operator(i.target);this.deserialize_node(i,n)}let t=[];for(let i of e.outputs)t.push(this.deserialize_graph_output(i));e.is_single_tensor_return?[t]=t:t=new T.tuple(t);let s=this.graph.output(t);return e.is_single_tensor_return&&s.meta.set("val",s.args[0].meta.get("val")),m.graph}deserialize_operator(e){let t=null,s=null;if(e.startsWith("_operator"))t=k,s=e.split(".").slice(1);else if(e.startsWith("torch"))t=r,s=e.split(".").slice(1);else return e.startsWith("#")?m.deserialize_extension_operator(e):e;let i=t;for(let n of s)if(i=T.getattr(i,n),!i)return e;return i}deserialize_node(e,t){let s=null;if(r._export.serde.serialize._SYM_BOOL_OPS.has(t)||r._export.serde.serialize._SYM_INT_OPS.has(t)){let i=e.outputs[0].value.as_name,n=this.deserialize_sym_op_inputs(e.inputs);s=this.graph.create_node("call_function",t,n,null,i),this.deserialize_sym_op_outputs(e,s)}else if(T.isinstance(t,r._ops.HigherOrderOperator)){let[i]=e.outputs,n=i.type==="as_tensor"?i.value.name:null,a=e.inputs.map(o=>this.deserialize_input(o.arg));s=this.graph.create_node("call_function",t,a,{},n),i.as_tensor!==null&&this.sync_fx_node(n,s),i.as_tensors!==null&&this.deserialize_multiple_outputs(e,s)}else if(T.isinstance(t,r._ops.OpOverload)){let i=this._is_single_tensor_return(t)?e.outputs[0].as_tensor.name:null,[n,a]=this.deserialize_inputs(t,e);s=this.graph.create_node("call_function",t,n,a,i),this.deserialize_outputs(e,s)}else throw new l.Error(`Unsupported node target type '${t}'.`);s.meta.update(this.deserialize_metadata(e.metadata)),s.op!=="placeholder"&&s.op!=="output"&&!s.meta.has("nn_module_stack")&&s.meta.set("nn_module_stack",new T.dict)}deserialize_input_spec(e){if(e.type==="user_input")return new r.export.graph_signature.InputSpec(r.export.graph_signature.InputKind.USER_INPUT,this.deserialize_argument_spec(e.user_input.arg),null);if(e.type==="parameter")return new r.export.graph_signature.InputSpec(r.export.graph_signature.InputKind.PARAMETER,new r.export.graph_signature.TensorArgument(e.parameter.arg.name),e.parameter.parameter_name);if(e.type==="buffer")return new r.export.graph_signature.InputSpec(r.export.graph_signature.InputKind.BUFFER,new r.export.graph_signature.TensorArgument(e.buffer.arg.name),e.buffer.buffer_name,e.buffer.persistent);if(e.type==="tensor_constant")return new r.export.graph_signature.InputSpec(r.export.graph_signature.InputKind.CONSTANT_TENSOR,new r.export.graph_signature.TensorArgument(e.tensor_constant.arg.name),e.tensor_constant.tensor_constant_name);if(e.type==="custom_obj")return new r.export.graph_signature.InputSpec(r.export.graph_signature.InputKind.CUSTOM_OBJ,new r.export.graph_signature.CustomObjArgument(e.custom_obj.arg.name,e.custom_obj.arg.class_fqn),e.custom_obj.custom_obj_name);if(e.type==="token")return new r.export.graph_signature.InputSpec(r.export.graph_signature.InputKind.TOKEN,new r.export.graph_signature.TokenArgument(e.token.arg.name),null);if(e.type==="constant_input")return new r.export.graph_signature.InputSpec(r.export.graph_signature.InputKind.USER_INPUT,new r.export.graph_signature.ConstantArgument(e.constant_input.name,this.deserialize_constant_input(e.constant_input.value)),null);throw new l.Error(`Unknown input spec ${e}`)}deserialize_constant_input(e){if(e.type==="as_int")return e.as_int;if(e.type==="as_float")return e.as_float;if(e.type==="as_string")return e.as_string;if(e.type==="as_bool")return e.as_bool;if(e.type==="as_none")return null;throw new l.Error(`Unhandled constant argument ${e} to deserialize.`)}deserialize_output_spec(e){if(e.type==="user_output")return new r.export.graph_signature.OutputSpec(r.export.graph_signature.OutputKind.USER_OUTPUT,this.deserialize_argument_spec(e.user_output.arg),null);if(e.type==="loss_output")return new r.export.graph_signature.OutputSpec(r.export.graph_signature.OutputKind.LOSS_OUTPUT,new r.export.graph_signature.TensorArgument(e.loss_output.arg.name),null);if(e.type==="buffer_mutation")return new r.export.graph_signature.OutputSpec(r.export.graph_signature.OutputKind.BUFFER_MUTATION,new r.export.graph_signature.TensorArgument(e.buffer_mutation.arg.name),e.buffer_mutation.buffer_name);if(e.type==="gradient_to_parameter")return new r.export.graph_signature.OutputSpec(r.export.graph_signature.OutputKind.GRADIENT_TO_PARAMETER,new r.export.graph_signature.TensorArgument(e.gradient_to_parameter.arg.name),e.gradient_to_parameter.parameter_name);if(e.type==="gradient_to_user_input")return new r.export.graph_signature.OutputSpec(r.export.graph_signature.OutputKind.GRADIENT_TO_USER_INPUT,new r.export.graph_signature.TensorArgument(e.gradient_to_user_input.arg.name),e.gradient_to_user_input.user_input_name);if(e.type==="user_input_mutation")return new r.export.graph_signature.OutputSpec(r.export.graph_signature.OutputKind.USER_INPUT_MUTATION,new r.export.graph_signature.TensorArgument(e.user_input_mutation.arg.name),e.user_input_mutation.user_input_name);if(e.type==="token")return new r.export.graph_signature.OutputSpec(r.export.graph_signature.OutputKind.TOKEN,new r.export.graph_signature.TokenArgument(e.token.arg.name),null);throw new l.Error(`Unknown output spec ${e}.`)}deserialize_signature(e){return new r.export.graph_signature.ExportGraphSignature(e.input_specs.map(t=>this.deserialize_input_spec(t)),e.output_specs.map(t=>this.deserialize_output_spec(t)))}deserialize(e,t,s,i,n){return this.shape_env=new r.fx.experimental.symbolic_shapes.ShapeEnv,this.symbol_name_to_symbol=new Map,this.constants=r._export.serde.serialize.deserialize_torch_artifact(s),this.signature=this.deserialize_signature(e.signature),this.symbol_name_to_range=n||new Map,this.example_inputs=null,i&&i.length>0&&r._export.serde.serialize.deserialize_torch_artifact(i),this.deserialize_graph(e.graph),{graph_module:r._export.exported_program._create_graph_module_for_export(this.module,this.graph),signature:this.signature,module_call_graph:null,names_to_symbols:this.symbol_name_to_symbol,state_dict:r._export.serde.serialize.deserialize_torch_artifact(t),constants:this.constants,example_inputs:this.example_inputs}}sync_fx_node(e,t){if(this.serialized_name_to_node.has(e))throw new l.Error(`Node ${e} has already been deserialized before.`);this.serialized_name_to_node.set(e,t),t.meta.set("val",this.serialized_name_to_meta.get(e))}deserialize_sym_op_inputs(e){return e.map(t=>this.deserialize_input(t.arg))}deserialize_inputs(e,t){let s=this._get_schema_from_target(e).arguments,i=new Map(t.inputs.map(o=>[o.name,this.deserialize_input(o.arg)])),n=new T.list,a=new T.dict;for(let o of s)!o.has_default_value()&&!o.kwarg_only?n.push(i.get(o.name)):i.has(o.name)&&a.set(o.name,i.get(o.name));return[n,a]}deserialize_input(e){let t=e.value,s=e.type;if(s==="as_none")return null;if(s==="as_tensor")return this.serialized_name_to_node.get(e.as_tensor.name);if(s==="as_scalar_type")return r._export.serde.serialize._SERIALIZE_TO_TORCH_DTYPE[e.as_scalar_type];if(s==="as_memory_format")return r._export.serde.serialize._SERIALIZE_TO_TORCH_MEMORY_FORMAT[e.as_memory_format];if(s==="as_layout")return r._export.serde.serialize._SERIALIZE_TO_TORCH_LAYOUT[e.as_layout];if(s!=="as_graph"){if(s==="as_device")return this.deserialize_device(e.as_device);if(s==="as_int")return e.as_int;if(s==="as_float")return e.as_float;if(s==="as_bool")return e.as_bool;if(s==="as_string")return e.as_string;if(s==="as_sym_int")return this.deserialize_sym_argument(e.as_sym_int);if(s==="as_sym_bool")return this.deserialize_sym_argument(e.as_sym_bool);if(Array.isArray(t)){if(t.length===0)return[];if(s==="as_tensors"){let i=[];for(let n of t)i.push(this.serialized_name_to_node.get(n.name));return i}else{if(s==="as_ints"||s==="as_floats"||s==="as_bools"||s==="as_strings")return Array.from(t);if(s==="as_sym_ints"||s==="as_sym_bools")return t.map(i=>this.deserialize_sym_argument(i));if(s==="as_optional_tensors"){let i=n=>{if(n.type==="as_none")return null;if(n.type==="as_tensor")return this.serialized_name_to_node.get(n.value.name);throw new l.Error(`Unsupported argument '${s}'.`)};return t.map(n=>i(n))}}throw new l.Error(`Unsupported argument '${s}'.`)}else{if(s==="as_custom_obj")return this.serialized_name_to_node.has(e.as_custom_obj.name)?this.serialized_name_to_node.get(e.as_custom_obj.name):this.constants[e.as_custom_obj.name];if(s==="as_operator")return this.deserialize_operator(e.as_operator)}}throw new l.Error(`Unsupported argument '${s}'.`)}deserialize_sym_argument(e){if(e instanceof r._export.serde.schema.SymIntArgument){if(e.type==="as_int")return e.as_int;if(e.type==="as_name")return this.serialized_name_to_node.get(e.as_name)}else if(e instanceof r._export.serde.schema.SymBoolArgument){if(e.type==="as_bool")return e.as_bool;if(e.type==="as_name")return m.serialized_name_to_node.get(e.as_name)}throw new l.Error(`Unsupported symbolic argument type '${e.type}`)}deserialize_sym_op_outputs(e,t){this.sync_fx_node(e.outputs[0].value.as_name,t)}deserialize_outputs(e,t){if(e.outputs.length!==0){if(e.outputs.length===1&&e.outputs[0].type==="as_tensor"){this.sync_fx_node(e.outputs[0].as_tensor.name,t);return}else if(e.outputs.length===1&&(e.outputs[0].value instanceof r._export.serde.schema.SymIntArgument||e.outputs[0].value instanceof r._export.serde.schema.SymBoolArgument)){this.sync_fx_node(e.outputs[0].value.as_name,t);return}this.deserialize_multiple_outputs(e,t)}}deserialize_multiple_outputs(e,t){let s=this.deserialize_metadata(e.metadata),i=(o,c,u,d)=>{let _="";if(u instanceof r._export.serde.schema.TensorArgument)_=u.name;else if(u instanceof r._export.serde.schema.SymIntArgument)_=u.as_name;else throw new l.Error(`Unsupported argument type '${u}'.`);let f=this.graph.create_node("call_function",k.getitem,new T.tuple([c,d]),null,_);this.sync_fx_node(_,f),o.push(this.serialized_name_to_meta.get(_)),f.meta.update(s)},n=(o,c,u)=>{for(let d=0;d<u.length;d++){let _=u[d];if(_ instanceof r._export.serde.schema.Argument&&(_=_.value),_ instanceof r._export.serde.schema.TensorArgument||_ instanceof r._export.serde.schema.SymIntArgument)i(o,c,_,d);else if(Array.isArray(_)){let f=this.graph.create_node("call_function",k.getitem,d);o.append([]),n(o[-1],f,_),f.meta.update(s),f.meta.set("val",o[-1])}else throw new l.Error(`Unsupported node output type: '${_}'.`)}},a=[];e.outputs.length===1?n(a,t,e.outputs[0].as_tensors):n(a,t,e.outputs),t.meta.set("val",new T.tuple(a)),this.serialized_name_to_node.set(t.name,t)}deserialize_metadata(e){let t=new T.dict,s=e.get("stack_trace");s&&t.set("stack_trace",s);let i=u=>{let d=null,_=[];if(u.startsWith("torch.nn"))d=r.nn,_=u.split(".").slice(1);else if(u.startsWith("torch"))d=r,_=u.split(".").slice(1);else return this.deserialize_operator(u);let f=d;for(let g of _){if(!T.hasattr(f,g))return u;f=T.getattr(f,g)}return f},n=e.get("nn_module_stack");if(n){let u=(_,f,g)=>[_,[f,g]],d=new Map(n.split(";").map(_=>u(..._.split(","))));t.set("nn_module_stack",d)}let a=e.get("source_fn_stack");if(a){let u=[];for(let d of a.split(";")){let[_,f]=d.split(",");u.push([_,i(f)])}t.set("source_fn_stack",u)}let o=e.get("torch_fn");o&&t.set("torch_fn",new T.tuple(o.split(";")));let c=e.get("custom");return c&&t.set("custom",JSON.parse(c)),t}deserialize_argument_spec(e){return e.type==="as_tensor"?new r.export.graph_signature.TensorArgument(e.as_tensor.name):e.type==="as_sym_int"?new r.export.graph_signature.SymIntArgument(e.as_sym_int.as_name):e.type==="as_custom_obj"?new r.export.graph_signature.ConstantArgument(e.as_custom_obj.name,this.deserialize_input(e)):new r.export.graph_signature.ConstantArgument("",this.deserialize_input(e))}deserialize_tensor_meta(e){let t=e.sizes.map(a=>this.deserialize_sym_int(a)),s=e.strides.map(a=>this.deserialize_sym_int(a)),i=this.deserialize_device(e.device),n=r._export.serde.serialize._SERIALIZE_TO_TORCH_DTYPE[e.dtype];return r.empty_strided(t,s,n,null,i)}deserialize_sym_int(e){if(e.as_expr!==void 0&&e.as_expr!==null){let t={};this.symbol_name_to_symbol.has(e.as_expr.expr_str)?t=this.symbol_name_to_symbol.get(e.as_expr.expr_str):t={};let s=e.as_expr.hint||null;return s&&(s.$type==="as_int"||s.as_int!==void 0)?this.deserialize_sym_int(s):this.shape_env.create_symintnode(t,s)}else{if(e.as_int!==void 0&&e.as_int!==null)return e.as_int;if(e.$type==="as_int")return e.$value}throw new l.Error("SymInt has invalid field type.")}deserialize_device(e){return e.index===null?new r.device(e.type):new r.device(e.type,e.index)}_get_schema_from_target(e){if(e instanceof r._ops.OpOverload)return e._schema;throw new l.Error(`Unsupported schema '${e.name}'.`)}_is_single_tensor_return(e){let s=this._get_schema_from_target(e).returns;return s.length===1&&s[0].real_type instanceof r.TensorType}}),this.registerType("torch._export.verifier.Verifier",class{}),this.registerType("torch._dynamo.convert_frame.CatchErrorsWrapper",class{}),this.registerType("torch._dynamo.convert_frame.ConvertFrameAssert",class{}),this.registerType("torch._dynamo.convert_frame.ConvertFrame",class{}),this.registerType("torch._dynamo.convert_frame.ConvertFrameBox",class{}),this.registerType("torch._dynamo.eval_frame._TorchDynamoContext",class{}),this.registerType("torch._dynamo.eval_frame.OptimizedModule",class extends r.nn.modules.module.Module{constructor(e,t){T.object.__setattr__(m,"_orig_mod",e),super(),this._orig_mod=e,this.dynamo_ctx=t,this.training=this._orig_mod.training}}),this.registerType("torch._dynamo.eval_frame.OptimizeContext",class extends r._dynamo.eval_frame._TorchDynamoContext{}),this.registerType("torch._dynamo.hooks.Hooks",class{}),this.registerType("torch._dynamo.output_graph.GraphCompileReason",class{}),this.registerType("torch._dynamo.repro.after_dynamo.WrapBackendDebug",class{}),this.registerType("torch._TorchCompileInductorWrapper",class{}),this.registerFunction("torch._inductor.compile_fx.compile_fx"),this.registerFunction("torch_utils.persistence._reconstruct_persistent_obj",e=>{let t=`_imported_module_${Math.floor(Math.random()*1e4)}`,s=new V.ModuleType(t);b.register("sys").modules.set(t,s);let i=new l.Execution.Context(s,null);b.exec(e.get("module_src"),i);let n=b.invoke(`${t}.${e.get("class_name")}`,[]),a=e.get("state");if(a)if(n.__setstate__)n.__setstate__(a);else for(let[o,c]of a)n[o]=c;return n}),this.registerFunction("torch_utils.misc.assert_shape",()=>{}),this.registerFunction("torch_utils.ops.conv2d_resample.conv2d_resample",()=>{}),this.registerFunction("torch_utils.ops.upfirdn2d.setup_filter",()=>{}),this.registerFunction("torch_utils.ops.bias_act",()=>{}),this.registerFunction("torch_utils.ops.fma.fma",()=>{}),this.registerType("torch.device",class{constructor(e,t){this.type=e,this.index=t||null}__str__(){return this.index===null?this.type:`${this.type}:${this.index}`}toString(){let e=this.index===null?"":`, index=${this.index}`;return`device(type='${this.type}'${e})`}}),this.registerType("torch.memory_format",class{constructor(e){this.name=e}__str__(){return`torch.${this.name}`}toString(){return this.__str__()}}),this.registerType("torch.dtype",class{constructor(e,t,s){this._scalar_type=e,this._name=t,this._itemsize=s}scalar_type(){return this._scalar_type}itemsize(){return this._itemsize}__reduce__(){return this._name}__str__(){return`torch.${this._name}`}toString(){return this.__str__()}}),this.registerType("torch.layout",class{constructor(e){this._name=e}__str__(){return`torch.${this._name}`}toString(){return this.__str__()}}),this.registerType("torch.qscheme",class{constructor(e){this._name=e}__str__(){return this._name}toString(){return this.__str__()}}),this.registerType("torch.utils.hooks.RemovableHandle",class{__setstate__(e){[this.hooks_dict_ref,this.id]=e,this.hooks_dict_ref=this.hooks_dict_ref||new Map}}),this.registerType("torch.storage._StorageBase",class{constructor(e,t){this._size=e,this._dtype=t,this._device=null}get device(){return this._device}get dtype(){return this._dtype}element_size(){return this._dtype.element_size}size(){return this._size}get data(){return this._cdata}_set_cdata(e){if(this.size()*this.dtype.itemsize()!==e.length)throw new l.Error("Typed storage data size mismatch.");this._cdata=e}_set_from_file(e){let s=e.read(8).reverse().reduce((a,o)=>a*256+o,0);if(s!==this.size())throw new l.Error("Typed storage size mismatch.");let i=this.dtype.itemsize(),n=e.stream(i*s);this._set_cdata(n)}static _new_with_file(e){let s=e.read(8).reverse().reduce((o,c)=>o*256+c,0),i=new this(s),n=i.dtype.itemsize(),a=e.stream(n*s);return i._set_cdata(a),i}}),this.registerType("torch.storage.UntypedStorage",class{constructor(e){this._size=e}_set_cdata(e){if(this._size!==e.length)throw new l.Error("Untyped storage data size mismatch.");this._cdata=e}}),this.registerType("torch.storage.TypedStorage",class{constructor(...e){if(e.length===0)this._size=0;else if(e.length===1&&Number.isInteger(e[0]))[this._size]=e;else if(e.length>=2&&Number.isInteger(e[0])&&e[1]instanceof r.dtype)e[3]instanceof r.device?[this._size,this.dtype,,this._device]=e:[this._size,this.dtype]=e;else throw new l.Error(`Unsupported TypedStorage arguments '${JSON.stringify(e)}'.`)}get device(){return this._device}get dtype(){return this._dtype}set dtype(e){this._dtype=e}element_size(){return this._dtype.element_size}size(){return this._size}get data(){return this._cdata}_set_cdata(e){if(this.size()*this.dtype.itemsize()!==e.length)throw new l.Error("Storage data size mismatch.");this._cdata=e}_set_from_file(e){let s=e.read(8).reverse().reduce((a,o)=>a*256+o,0);if(s!==this.size())throw new l.Error("Storage size mismatch.");let i=this.dtype.itemsize(),n=e.stream(i*s);this._set_cdata(n)}static _new_with_file(e){let s=e.read(8).reverse().reduce((o,c)=>o*256+c,0),i=new this(s),n=i.dtype.itemsize(),a=e.stream(n*s);return i._set_cdata(a),i}}),this.registerType("torch.storage._LegacyStorage",class extends r.storage.TypedStorage{}),this.registerType("torch.BoolStorage",class extends r.storage._LegacyStorage{constructor(...e){super(...e),this.dtype=r.bool}}),this.registerType("torch.ByteStorage",class extends r.storage._LegacyStorage{constructor(...e){super(...e),this.dtype=r.uint8}}),this.registerType("torch.CharStorage",class extends r.storage._LegacyStorage{constructor(...e){super(...e),this.dtype=r.int8}}),this.registerType("torch.ShortStorage",class extends r.storage._LegacyStorage{constructor(...e){super(...e),this.dtype=r.int16}}),this.registerType("torch.IntStorage",class extends r.storage._LegacyStorage{constructor(...e){super(...e),this.dtype=r.int32}}),this.registerType("torch.LongStorage",class extends r.storage._LegacyStorage{constructor(...e){super(...e),this.dtype=r.int64}}),this.registerType("torch.HalfStorage",class extends r.storage._LegacyStorage{constructor(...e){super(...e),this.dtype=r.float16}}),this.registerType("torch.FloatStorage",class extends r.storage._LegacyStorage{constructor(...e){super(...e),this.dtype=r.float32}}),this.registerType("torch.DoubleStorage",class extends r.storage._LegacyStorage{constructor(...e){super(...e),this.dtype=r.float64}}),this.registerType("torch.ComplexHalfStorage",class extends r.storage._LegacyStorage{constructor(...e){super(...e),this.dtype=r.complex32}}),this.registerType("torch.ComplexFloatStorage",class extends r.storage._LegacyStorage{constructor(...e){super(...e),this.dtype=r.complex64}}),this.registerType("torch.ComplexDoubleStorage",class extends r.storage._LegacyStorage{constructor(...e){super(...e),this.dtype=r.complex128}}),this.registerType("torch.QInt8Storage",class extends r.storage._LegacyStorage{constructor(...e){super(...e),this.dtype=r.qint8}}),this.registerType("torch.QUInt8Storage",class extends r.storage._LegacyStorage{constructor(...e){super(...e),this.dtype=r.quint8}}),this.registerType("torch.QInt32Storage",class extends r.storage._LegacyStorage{constructor(...e){super(...e),this.dtype=r.qint32}}),this.registerType("torch.BFloat16Storage",class extends r.storage._LegacyStorage{constructor(...e){super(...e),this.dtype=r.bfloat16}}),this.registerType("torch.Size",class extends Array{constructor(e){super(e.length);for(let t=0;t<e.length;t++)this[t]=e[t]}__len__(){return this.length}}),this.registerType("torch._C.TensorMeta",class{}),this.registerType("torch._C.TensorBase",class extends r._C.TensorMeta{}),this.registerType("torch.Tensor",class extends r._C.TensorBase{constructor(e,t,s,i,n,a){super(),e&&(this._storage=e),t!=null&&(this._shape=t),s&&(this._dtype=s),this._layout=i||r.strided,n&&(this._device=n),a!==void 0&&(this.requires_grad=a)}get device(){return this._device!==void 0?this._device:this.storage().device}get dtype(){return this._dtype!==void 0?this._dtype:this._layout===r.sparse_coo?this._values.dtype:this.storage().dtype}get shape(){return this._shape}get layout(){return this._layout}get values(){if(this._layout===r.sparse_coo)return this._values;throw new l.Error(`Unsupported values in layout'${this._layout.__str__()}'.`)}get indices(){if(this._layout===r.sparse_coo)return this._indices;throw new l.Error(`Unsupported indices in layout'${this._indices.__str__()}'.`)}get is_quantized(){return this.__quantized__===!0}get is_nested(){return this.__nested__===!0}get is_sparse(){return this.layout!==r.strided}size(){return this._shape}storage(){if(!this._storage){let e=this.__class__.__name__==="Tensor"?"FloatStorage":this.__storage__.__name__.replace("Tensor","Storage");this._storage=m.invoke(`${this.__class__.__module__}.${e}`,[])}return this._storage}storage_offset(){return this._storage_offset}stride(){return this._stride}resize_(e){this._shape=e}__len__(){return this._shape[0]}__setstate__(e){switch(e.length){case 3:break;case 4:[this._storage,this._storage_offset,this._shape,this._stride]=e;break;case 5:[this.data,,this._backward_hooks,this.requires_grad]=e;break;default:throw new l.Error(`Unsupported tensor state length '${e.length}'.`)}}set_(e,t,s,i){this._storage=e,this._storage_offset=t,this._shape=s,this._stride=i}__bool__(){return!0}__int__(){let e=this.storage();if(e&&e.dtype.__reduce__()==="int64"&&e.data.length===8){let t=e.data.peek?e.data.peek():e.data;return new DataView(t.buffer,t.byteOffset,t.byteLength).getBigInt64(0,!0)}return NaN}__float__(){let e=this.storage();if(e&&e.dtype.__reduce__()==="float32"&&e.size()!==void 0&&e.data.length===4){let t=e.data.peek?e.data.peek():e.data;return new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat32(0,!0)}return NaN}__str__(){return"tensor(...)"}static _make_wrapper_subclass(e,t,s,i,n,a,o,c){let u=new r.Tensor(null,t,i,a,o,c);return u.__setstate__([null,n,t,s]),u}}),this.registerType("torch.nn.parameter.Parameter",class extends r.Tensor{constructor(e,t){super(),this.data=e||new r.Tensor([]),this.requires_grad=t===void 0?!0:t}}),this.registerType("torch.nn.parameter.UninitializedParameter",class extends r.nn.parameter.Parameter{constructor(e){super(void 0,e)}}),this.registerType("torch.nn.parameter.UninitializedBuffer",class extends r.Tensor{}),this.registerType("torch.BoolTensor",class extends r.Tensor{}),this.registerType("torch.ByteTensor",class extends r.Tensor{}),this.registerType("torch.CharTensor",class extends r.Tensor{}),this.registerType("torch.ShortTensor",class extends r.Tensor{}),this.registerType("torch.IntTensor",class extends r.Tensor{}),this.registerType("torch.LongTensor",class extends r.Tensor{}),this.registerType("torch.HalfTensor",class extends r.Tensor{}),this.registerType("torch.FloatTensor",class extends r.Tensor{}),this.registerType("torch.DoubleTensor",class extends r.Tensor{}),this.registerType("torch.ComplexFloatTensor",class extends r.Tensor{}),this.registerType("torch.ComplexDoubleTensor",class extends r.Tensor{}),this.registerType("torch.QInt8Tensor",class extends r.Tensor{}),this.registerType("torch.QUInt8Tensor",class extends r.Tensor{}),this.registerType("torch.QInt32Tensor",class extends r.Tensor{}),this.registerType("torch.BFloat16Tensor",class extends r.Tensor{}),this.registerType("torch.cuda._CudaLegacyStorage",class extends r.storage._LegacyStorage{}),this.registerType("torch.cuda.FloatStorage",class extends r.cuda._CudaLegacyStorage{}),this.registerType("torch.cuda.FloatTensor",class extends r.Tensor{}),this.registerType("torch.cuda.DoubleStorage",class extends r.cuda._CudaLegacyStorage{}),this.registerType("torch.cuda.DoubleTensor",class extends r.Tensor{}),this.registerType("torch.cuda.amp.grad_scaler.GradScaler",class{}),this.registerType("torchao.utils.TorchAOBaseTensor",class extends r.Tensor{}),this.registerType("torchao.dtypes.affine_quantized_tensor.AffineQuantizedTensor",class extends Z.utils.TorchAOBaseTensor{}),this.registerType("torchao.dtypes.utils.Layout",class{}),this.registerType("torchao.dtypes.floatx.float8_layout.Float8Layout",class extends Z.dtypes.utils.Layout{}),this.registerType("torchao.dtypes.utils.AQTTensorImpl",class extends Z.utils.TorchAOBaseTensor{}),this.registerType("torchao.dtypes.floatx.float8_layout.Float8AQTTensorImpl",class extends Z.dtypes.utils.AQTTensorImpl{}),this.registerType("torchao.quantization.quant_primitives.ZeroPointDomain",class extends this.enum.Enum{}),this.registerFunction("torch.cuda.amp.grad_scaler._refresh_per_optimizer_state"),this.registerType("torch.SymBool",class{constructor(e){this.node=e}}),this.registerType("torch.SymInt",class{constructor(e){this.node=e}}),this.register("torch.nn").Module=this.register("torch.nn.modules.module").Module,this.register("torch.optim").Adam=this.register("torch.optim.adam").Adam,this.register("torch.nn").ReLU=this.register("torch.nn.modules.activation").ReLU,this.register("sklearn.utils").Bunch=this.register("sklearn.utils._bunch").Bunch,r.uint8=r.ByteStorage.dtype=new r.dtype(0,"uint8",1),r.int8=r.CharStorage.dtype=new r.dtype(1,"int8",1),r.int16=r.ShortStorage.dtype=new r.dtype(2,"int16",2),r.int32=r.IntStorage.dtype=new r.dtype(3,"int32",4),r.int64=r.LongStorage.dtype=new r.dtype(4,"int64",8),r.float16=r.HalfStorage.dtype=new r.dtype(5,"float16",2),r.float32=r.FloatStorage.dtype=new r.dtype(6,"float32",4),r.float64=r.DoubleStorage.dtype=new r.dtype(7,"float64",8),r.complex32=r.ComplexHalfStorage.dtype=new r.dtype(8,"complex32",4),r.complex64=r.ComplexFloatStorage.dtype=new r.dtype(9,"complex64",8),r.complex128=r.ComplexDoubleStorage.dtype=new r.dtype(10,"complex128",16),r.bool=r.BoolStorage.dtype=new r.dtype(11,"boolean",1),r.qint8=r.QInt8Storage.dtype=new r.dtype(12,"qint8",1),r.quint8=r.QUInt8Storage.dtype=new r.dtype(13,"quint8",1),r.qint32=r.QInt32Storage.dtype=new r.dtype(14,"qint32",4),r.bfloat16=r.BFloat16Storage.dtype=new r.dtype(15,"bfloat16",2),r.quint4x2=new r.dtype(16,"quint4x2"),r.quint2x4=new r.dtype(17,"quint2x4"),r.bits1x8=new r.dtype(18,"bits1x8"),r.bits2x4=new r.dtype(19,"bits2x4"),r.bits4x2=new r.dtype(20,"bits4x2"),r.bits8=new r.dtype(21,"bits8"),r.bits16=new r.dtype(22,"bits16"),r.float8_e5m2=new r.dtype(23,"float8_e5m2",1),r.float8_e5m2fnuz=new r.dtype(24,"float8_e5m2fnuz",1),r.float8_e4m3fn=new r.dtype(25,"float8_e4m3fn",1),r.float8_e4m3fnuz=new r.dtype(26,"float8_e4m3fnuz",1),r.uint16=new r.dtype(27,"uint16",2),r.uint32=new r.dtype(28,"uint32",4),r.uint64=new r.dtype(29,"uint64",8),r._export.serde.serialize._SERIALIZE_TO_TORCH_DTYPE=Object.fromEntries([["uint8","BYTE"],["int8","CHAR"],["int16","SHORT"],["int32","INT"],["int64","LONG"],["float16","HALF"],["float32","FLOAT"],["float64","DOUBLE"],["complex32","COMPLEXHALF"],["complex64","COMPLEXFLOAT"],["complex128","COMPLEXDOUBLE"],["bool","BOOL"],["bfloat16","BFLOAT16"]].map(([e,t])=>[r._export.serde.schema.ScalarType[t],r[e]])),r.contiguous_format=new r.memory_format("contiguous_format"),r.channels_last=new r.memory_format("channels_last"),r.channels_last_3d=new r.memory_format("channels_last_3d"),r.preserve_format=new r.memory_format("preserve_format"),r._export.serde.serialize._SERIALIZE_TO_TORCH_MEMORY_FORMAT=Object.fromEntries([["contiguous_format","ContiguousFormat"],["channels_last","ChannelsLast"],["channels_last_3d","ChannelsLast3d"],["preserve_format","PreserveFormat"]].map(([e,t])=>[r._export.serde.schema.MemoryFormat[t],r[e]])),r.strided=new r.layout("strided"),r.sparse_coo=new r.layout("sparse_coo"),r.sparse_csr=new r.layout("sparse_csr"),r.sparse_csc=new r.layout("sparse_csc"),r.sparse_bsr=new r.layout("sparse_bsr"),r.sparse_bsc=new r.layout("sparse_bsc"),r._mkldnn=new r.layout("_mkldnn"),r._export.serde.serialize._SERIALIZE_TO_TORCH_LAYOUT=Object.fromEntries([["sparse_coo","SparseCoo"],["sparse_csr","SparseCsr"],["sparse_csc","SparseCsc"],["sparse_bsr","SparseBsr"],["sparse_bsc","SparseBsc"],["_mkldnn","_mkldnn"],["strided","Strided"]].map(([e,t])=>[r._export.serde.schema.Layout[t],r[e]])),r.per_tensor_affine=new r.qscheme("torch.per_tensor_affine"),r.per_channel_affine=new r.qscheme("torch.per_channel_affine"),r.per_tensor_symmetric=new r.qscheme("torch.per_tensor_symmetric"),r.per_channel_symmetric=new r.qscheme("torch.per_channel_symmetric"),r.per_channel_affine_float_qparams=new r.qscheme("torch.per_channel_affine_float_qparams"),r.inf=this.register("math").inf,this.registerFunction("fastcore.basics._using_attr"),this.registerFunction("fastcore.imports.noop"),this.registerType("fastcore.basics.fastuple",class{}),this.registerType("fastcore.basics.GetAttr",class{}),this.registerType("fastcore.dispatch._TypeDict",class{}),this.registerType("fastcore.dispatch.TypeDispatch",class{}),this.registerType("fastcore.foundation.L",class{}),this.registerType("fastcore.transform.Pipeline",class extends T.object{}),this.registerType("fastcore.transform.Transform",class extends T.object{}),this.registerType("fastcore.transform.DisplayedTransform",class extends H.transform.Transform{}),this.registerType("fastcore.transform.ItemTransform",class extends H.transform.Transform{}),this.registerType("fastai.basic_train.Learner",class{}),this.registerType("fastai.basic_train.Recorder",class{}),this.registerFunction("fastai.torch_core._fa_rebuild_tensor",(e,...t)=>{let s=r._utils._rebuild_tensor_v2(...t);return m.invoke(e,[s])}),this.registerFunction("fastai.torch_core.trainable_params"),this.registerFunction("fastai.torch_core._rebuild_from_type",(e,t,s,i)=>{let n=m.invoke(t,[e(...s)]);return Object.assign(n,i),n}),this.registerType("fastai.torch_core.Module",class extends r.nn.modules.module.Module{}),this.registerType("fastai.torch_core.TensorBase",class extends r.Tensor{constructor(e){super(),Object.assign(this,e)}}),this.registerType("fastai.torch_core.TensorCategory",class extends R.torch_core.TensorBase{}),this.registerType("fastai.torch_core.TensorImageBase",class extends R.torch_core.TensorBase{}),this.registerType("fastai.torch_core.TensorImage",class extends R.torch_core.TensorImageBase{}),this.registerType("fastai.torch_core.TensorMask",class extends R.torch_core.TensorImageBase{}),this.registerType("fastai.torch_core.TensorMultiCategory",class extends R.torch_core.TensorCategory{}),this.registerFunction("fastai.torch_core.uniform"),this.registerType("fastai.callback.core.Callback",class extends H.basics.GetAttr{}),this.registerType("fastai.callback.core.TrainEvalCallback",class extends R.callback.core.Callback{}),this.registerType("fastai.callback.fp16.AMPMode",class extends this.enum.Enum{}),this.registerType("fastai.callback.fp16.MixedPrecision",class{}),this.registerFunction("fastai.callback.hook._hook_inner"),this.registerType("fastai.callback.hook.Hook",class extends T.object{}),this.registerType("fastai.callback.hook.Hooks",class extends T.object{}),this.registerType("fastai.callback.mixup.MixHandler",class extends R.callback.core.Callback{}),this.registerType("fastai.callback.mixup.CutMix",class extends R.callback.mixup.MixHandler{}),this.registerType("fastai.callback.progress.ProgressCallback",class{}),this.registerType("fastai.callback.progress.ShowGraphCallback",class{}),this.registerType("fastai.callback.tracker.EarlyStoppingCallback",class{}),this.registerType("fastai.callback.tracker.TrackerCallback",class{}),this.registerType("fastai.callback.tracker.SaveModelCallback",class extends R.callback.tracker.TrackerCallback{}),this.registerType("fastai.data.core.DataLoaders",class extends H.basics.GetAttr{}),this.registerType("fastai.data.core.Datasets",class{}),this.registerType("fastai.data.load.DataLoader",class extends H.basics.GetAttr{}),this.registerType("fastai.data.core.FilteredBase",class{}),this.registerType("fastai.data.core.TfmdDL",class extends R.data.load.DataLoader{}),this.registerType("fastai.data.core.TfmdLists",class{}),this.registerType("fastai.data.load._FakeLoader",class{}),this.registerFunction("fastai.data.load._wif"),this.registerType("fastai.data.transforms.Categorize",class{}),this.registerType("fastai.data.transforms.Category",class{}),this.registerType("fastai.data.transforms.CategoryMap",class{}),this.registerType("fastai.data.transforms.ColReader",class{}),this.registerType("fastai.data.transforms.IntToFloatTensor",class{}),this.registerType("fastai.data.transforms.MultiCategorize",class{}),this.registerType("fastai.data.transforms.Normalize",class{}),this.registerType("fastai.data.transforms.parent_label",class{}),this.registerType("fastai.data.transforms.OneHotEncode",class{}),this.registerType("fastai.data.transforms.RegressionSetup",class{}),this.registerType("fastai.data.transforms.ToTensor",class{}),this.registerType("fastai.data_block.CategoryList",class{}),this.registerType("fastai.data_block.CategoryProcessor",class{}),this.registerType("fastai.imports.noop",class{}),this.registerType("fastai.layers.AdaptiveConcatPool2d",class{}),this.registerType("fastai.layers.ConvLayer",class{}),this.registerType("fastai.layers.Embedding",class{}),this.registerType("fastai.layers.Flatten",class{}),this.registerType("fastai.layers.FlattenedLoss",class{}),this.registerType("fastai.layers.LinBnDrop",class{}),this.registerType("fastai.layers.MergeLayer",class{}),this.registerType("fastai.layers.PixelShuffle_ICNR",class{}),this.registerType("fastai.layers.ResBlock",class{}),this.registerType("fastai.layers.SelfAttention",class{}),this.registerType("fastai.layers.SigmoidRange",class{}),this.registerType("fastai.layers.TimeDistributed",class{}),this.registerType("fastai.layers.ToTensorBase",class{}),this.registerType("fastai.learner._ConstantFunc",class{}),this.registerType("fastai.learner.Metric",class{}),this.registerType("fastai.learner.AvgLoss",class extends R.learner.Metric{}),this.registerType("fastai.learner.AvgMetric",class extends R.learner.Metric{}),this.registerType("fastai.learner.AvgSmoothLoss",class extends R.learner.Metric{}),this.registerType("fastai.learner.CastToTensor",class extends R.callback.core.Callback{}),this.registerType("fastai.learner.Dice",class extends R.learner.Metric{}),this.registerType("fastai.learner.Learner",class extends H.basics.GetAttr{}),this.registerType("fastai.learner.Recorder",class{}),this.registerType("fastai.losses.BaseLoss",class{}),this.registerType("fastai.losses.BCEWithLogitsLossFlat",class{}),this.registerType("fastai.losses.CrossEntropyLossFlat",class extends R.losses.BaseLoss{}),this.registerType("fastai.losses.FocalLoss",class extends R.torch_core.Module{}),this.registerType("fastai.losses.FocalLossFlat",class extends R.losses.BaseLoss{}),this.registerType("fastai.losses.LabelSmoothingCrossEntropy",class extends R.torch_core.Module{}),this.registerType("fastai.metrics.AccumMetric",class extends R.learner.Metric{}),this.registerType("fastai.metrics.Dice",class{}),this.registerType("fastai.metrics.JaccardCoeff",class{}),this.registerFunction("fastai.metrics._rmse"),this.registerFunction("fastai.metrics.accuracy"),this.registerFunction("fastai.metrics.accuracy_multi"),this.registerFunction("fastai.metrics.foreground_acc"),this.registerFunction("fastai.metrics.mse"),this.registerFunction("fastai.metrics.error_rate"),this.registerType("fastai.optimizer._BaseOptimizer",class{}),this.registerType("fastai.optimizer.Optimizer",class extends R.optimizer._BaseOptimizer{}),this.registerFunction("fastai.optimizer.Adam"),this.registerFunction("fastai.optimizer.adam_step"),this.registerFunction("fastai.optimizer.average_grad"),this.registerFunction("fastai.optimizer.average_sqr_grad"),this.registerFunction("fastai.optimizer.RAdam"),this.registerFunction("fastai.optimizer.step_stat"),this.registerFunction("fastai.optimizer.weight_decay"),this.registerType("fastai.tabular.core.Categorify",class{}),this.registerType("fastai.tabular.core.FillMissing",class{}),this.registerType("fastai.tabular.core.FillStrategy",class{}),this.registerType("fastai.tabular.core.ReadTabBatch",class extends H.transform.ItemTransform{}),this.registerType("fastai.tabular.core.TabDataLoader",class extends R.data.core.TfmdDL{}),this.registerType("fastai.tabular.data.TabularDataLoaders",class extends R.data.core.DataLoaders{}),this.registerType("fastai.tabular.core.Tabular",class{}),this.registerType("fastai.tabular.core.TabularPandas",class extends R.tabular.core.Tabular{}),this.registerType("fastai.tabular.core.TabWeightedDL",class{}),this.registerType("fastai.tabular.learner.TabularLearner",class extends R.learner.Learner{}),this.registerType("fastai.tabular.model.TabularModel",class{}),this.registerFunction("fastai.vision.augment.aug_transforms"),this.registerFunction("fastai.vision.augment.dihedral_mat"),this.registerType("fastai.vision.augment._BrightnessLogit",class{}),this.registerType("fastai.vision.augment._ContrastLogit",class{}),this.registerType("fastai.vision.augment._WarpCoord",class{}),this.registerType("fastai.vision.augment.RandTransform",class extends H.transform.DisplayedTransform{}),this.registerType("fastai.vision.augment.AffineCoordTfm",class extends R.vision.augment.RandTransform{}),this.registerType("fastai.vision.augment.Brightness",class{}),this.registerType("fastai.vision.augment.flip_mat",class{}),this.registerType("fastai.vision.augment.Flip",class{}),this.registerType("fastai.vision.augment.RandomResizedCrop",class{}),this.registerType("fastai.vision.augment.RandomResizedCropGPU",class{}),this.registerType("fastai.vision.augment.Resize",class{}),this.registerType("fastai.vision.augment.rotate_mat",class{}),this.registerFunction("fastai.vision.augment.TensorImage.lighting"),this.registerType("fastai.vision.augment.Warp",class extends R.vision.augment.AffineCoordTfm{}),this.registerType("fastai.vision.augment.zoom_mat",class{}),this.registerType("fastai.vision.core.PILImage",class{}),this.registerType("fastai.vision.core.PILMask",class{}),this.registerType("fastai.vision.core.AddMaskCodes",class{}),this.registerType("fastai.vision.data.ImageList",class{}),this.registerType("fastai.vision.data.ImageItemList",class{}),this.registerType("fastai.vision.image.Image",class{}),this.registerType("fastai.vision.image.RandTransform",class{}),this.registerType("fastai.vision.image.TfmCrop",class{}),this.registerFunction("fastai.vision.learner._resnet_split"),this.registerFunction("fastai.vision.learner.default_split"),this.registerFunction("fastai.vision.learner.default_split"),this.registerType("fastai.vision.learner.TimmBody",class{}),this.registerType("fastai.vision.models.unet.DynamicUnet",class{}),this.registerType("fastai.vision.models.unet.ResizeToOrig",class{}),this.registerType("fastai.vision.models.unet.UnetBlock",class{}),this.registerType("fastai.vision.models.xresnet.XResNet",class{}),this.registerFunction("fastai.vision.transform._crop_pad")}exec(p,m){let S=this.ast.parse(p,"",null);if(!S)throw new l.Error("Module '?' parse error.");this.block(S.body,m)}debug(){}source(p){return this._sources.has(p)?this._sources.get(p):null}read(p){let m=this.source(p);if(m){let b=this.debug(p);return this.parse(p,m,b)}return null}parse(p,m,b){let S=this.ast,C=this._utf8Decoder.decode(m),T=S.parse(C,p,b);if(!T)throw new l.Error(`Module '${p}' parse error.`);return T}import(p,m,b){if(b){let w=m.split(".");if(w.length<b)throw new l.Error("Invalid relative import beyond top-level package.");w=w.slice(0,w.length-b);let k=w.join(".");p=p?[k,p].join("."):k}let S=p.lastIndexOf("."),C=null,T=null;if(S>0&&(C=p.substring(0,S),T=p.substring(S+1),this.import(C)),!this._modules.has(p)){let w=this._registry.get(p)||new this.builtins.module(p);w.__package__=p,this._modules.set(p,w);let k=p.split(".").join("/");w.__path__=[k];let N=`${k}.py`,h=this.read(N);if(h){w.__file__=N;for(let[Q,J]of Object.entries(this.builtins))switch(Q){case"__class__":case"__package__":case"__module__":case"__name__":case"__path__":case"__file__":break;default:w[Q]=J;break}let L=new l.Execution.Context(w,null);p!=="builtins"&&L.set("__builtins__",this._modules.get("builtins")),this.block(h.body,L)}if(C){let L=this._modules.get(C);L[T]=w}}return this._modules.get(p)}__import__(p,m,b,S,C){let T=null;if(C=C||0,C===0)T=this.import(p);else{m=m||{};let w=m.__package__;if(!w){let k=m.__spec__;if(k)w=k.parent;else{let h=m.__name__.split(".");h.pop(),w=h.join(".")}}T=this.import(p,w,C)}if(S){if(T.__path__){let w=(k,N,h)=>{for(let L of N)L==="*"?!h&&k.__all__&&w(k,k.__all__,!0):k[L]||this.import(`${k.__name__}.${L}`);return k};w(T,S)}}else{if(C===0)return this.import(p.split(".")[0]);if(p)throw new l.Error(`Unsupported relative import '${p}'.`)}return T}module(p){return this._modules.get(p)}resolve(p){let m=p.lastIndexOf("."),b=m===-1?p:p.substring(m+1,p.length),S=m===-1?"":p.substring(0,m),C=this.import(S),T=C?C[b]:null;if(!T){if(!this._unresolved.has(p)){let w=p.split(".").shift();this._registry.has(w)&&w!=="__main__"&&this.emit("resolve",p);let k=this._createType(p,class{});this._unresolved.set(p,k)}T=this._unresolved.get(p)}return T}invoke(p,m){let b=this.builtins;if(typeof p=="string"&&(p=this.resolve(p)),p){if(p.__class__===b.type){if(p.prototype&&p.prototype.__class__===p)return Reflect.construct(p,m);let S=Object.create(p);return S.__init__&&typeof S.__init__=="function"&&S.__init__(...m),S}else if(p.__class__===b.function)return p.__call__?p.__call__(m):p(...m)}throw new l.Error("Unsupported invoke target.")}call(p,m,b,S,C){let T=this.builtins,w=this.target(p,C),k=b.map(h=>this.expression(h,C));if(!w||m!==null&&!w[m])if(m==="__new__"&&k.length===1&&k[0]===w)m=null,k.shift();else{let h=`${this.identifier(p)}.${m}`;throw new l.Error(`Unknown function '${h}'.`)}let N=m?w[m]:w;if(N.__class__===T.type){if(N.prototype&&N.prototype.__class__===N)return Reflect.construct(N,k);let h=Object.create(N);return h.__class__=N,h.__init__&&typeof h.__init__=="function"&&h.__init__(...b),h}if(N.__class__===T.function&&N.__call__)return N.__call__(k);if(N.__class__===T.method&&N.__call__)return N.__call__([w].concat(k));if(typeof N=="function")return N.apply(w,k);throw new l.Error("Unsupported call expression.")}apply(p,m,b){let S=Array.prototype.slice.call(m);b=new l.Execution.Context(b.globals,{}),m=p.args.posonlyargs.concat(p.args.args);let C=m.length-p.args.defaults.length;for(let T=0;T<p.args.args.length;T++){let w=p.args.args[T],k=null;if(S.length>0)k=S.shift();else if(T>=C)k=this.expression(p.args.defaults[T-C],b);else throw new l.Error("Missing required positional argument.");b.set(w.arg,k)}return this.block(p.body,b)}block(p,m){for(p=Array.prototype.slice.call(p);p.length>0;){let b=p.shift(),S=this.statement(b,m);if(S!==void 0)return S}}statement(p,m){let b=this.ast,S=this.builtins;if(!(p instanceof b.Pass)){if(!(p instanceof b.Constant)){if(p instanceof b.Return)return this.expression(p.value,m);if(p instanceof b.FunctionDef){let C=m.get("__name__"),T=this,N={__class__:m.get("__class__")===S.module?S.function:S.method,__globals__:m,__module__:C,__name__:p.name,__code__:p,__call__(h){return T.apply(this.__code__,h,this.__globals__)}};m.set(p.name,N)}else if(p instanceof b.ClassDef){let C=p.bases.map(N=>this.base(N,m));if(C.length>1)throw new l.Error(`Unsupported multiple bases for class '${p.name}'.`);let T=C.length===1?C[0]:null,w=`${m.get("__name__")}.${p.name}`,k=this._createType(w,T?class extends T{}:class{});k.__bases__=C,m.set(p.name,k),this.block(p.body,new l.Execution.Context(m.globals,k.prototype))}else if(p instanceof b.AnnAssign){let C=this.identifier(p.target,m);m.set(C,p.value?this.expression(p.value,m):void 0)}else if(p instanceof b.Assign)this.expression(p,m);else if(p instanceof b.If){let C=this.expression(p.test,m);if(C===!0||C){let T=this.block(p.body,m);if(T!==void 0)return T}else if(C===!1){if(p.orelse){let T=this.block(p.orelse,m);if(T!==void 0)return T}}else throw new l.Error("Unsupported condition.")}else if(p instanceof b.For)if(p.target instanceof b.Name&&!(p.iter instanceof b.Tuple)){let C=this.expression(p.iter,m),T=p.target;for(let w of C){this.statement({type:"=",target:T,expression:{type:"number",value:w}},m);let k=this.block(p.body.statements,m);if(k!==void 0)return k}}else throw new l.Error("Unsupported 'for' statement.");else if(p instanceof b.While){if(this.expression(p.test,m)){let T=this.block(p.body.statements,m);if(T!==void 0)return T}}else if(p instanceof b.With){let C=[];for(let w of p.items)C.push(this.expression(w.context_expr,m));for(let w of C)w.__enter__&&w.__enter__.__call__&&w.__enter__.__call__([w]);let T=this.block(p.body,m);for(let w of C)w.__exit__&&w.__exit__.__call__&&w.__exit__.__call__([w]);if(T!==void 0)return T}else if(p instanceof b.Expr)this.expression(p.value,m);else if(p instanceof b.Import)for(let C of p.names){let T=this.__import__(C.name,m);if(C.asname){let w=C.name.split(".").reverse();for(w.pop();w.length>0;)T=T[w.pop()];m.set(C.asname,T)}else m.set(C.name.split(".")[0],T)}else if(p instanceof b.ImportFrom){let C=p.names.map(w=>w.name),T=this.__import__(p.module,m.globals,m.locals,C,p.level);for(let w of p.names){let k=w.name,N=w.asname?w.asname:null;if(!T[k])throw new l.Error(`Cannot import '${k}' from '${p.module}'.`);m.set(N||k,T[k])}}else throw new l.Error(`Unsupported statement '${p.__class__.__name__}'.`)}}}expression(p,m){let b=this.ast,S=this.builtins,C=this.typing,T=m.get("self");switch(p.__class__.__name__){case"Assign":{let[w]=p.targets;if(w instanceof b.Name){let k=this.expression(p.value,m);m.set(w.id,k);return}else if(w instanceof b.Subscript){if(w.value instanceof b.Name&&w.slice instanceof b.List&&w.slice.elts.length===1){let k=this.expression(w.slice.elts[0],m),N=w.value.id;N==="__annotations__"&&m.set(N,m.get(N)||{});let h=m.get(N),L=this.expression(p.value,m);h instanceof Map?h.set(k,L):h[k]=L;return}}else if(w instanceof b.Attribute){let k=this.expression(w.value,m),N=this.expression(p.value,m);k[w.attr]=N;return}else if(w instanceof b.Tuple){m.target.push(w.elts);let k=this.expression(p.value,m);if(m.target.pop(),w.elts.every(N=>N instanceof b.Name)){if(w.elts.length<k.length)throw new l.Error(`ValueError: too many values to unpack (expected ${w.value.length}, actual ${k.length}).`);if(w.elts.length>k.length)throw new l.Error(`ValueError: not enough values to unpack (expected ${w.value.length}, actual ${k.length}).`);for(let N=0;N<k.length;N++)m.set(w.elts[N].id,k[N]);return}}break}case"List":return p.elts.map(w=>this.expression(w,m));case"Constant":return p.value;case"Subscript":{if(p.value instanceof b.Name&&!(p.slice instanceof b.Tuple)){let k=p.value.id;if(m.get(k)){let N=this.expression(p.slice,m),h=m.get(k);return h instanceof Map?h.get(N):h[N<0?h.length+N:N]}}let w=this.expression(p.value,m);if(w&&p.slice instanceof b.List&&(w.__class__===C._TupleType||w.__class__===C._SpecialGenericAlias||w.__class__===C._SpecialForm)){let k=W({},w);return k.__args__=p.slice.elts.map(N=>this.expression(N,m)),k}if(p.slice instanceof b.List&&p.slice.elts.length===1){let k=this.expression(p.slice.elts[0],m);return w instanceof Map?w.get(k):w[k<0?w.length+k:k]}break}case"Attribute":return this.target(p.value,m)[p.attr];case"Call":{let w=p.func;return w instanceof b.Attribute?this.call(w.value,w.attr,p.args,p.keywords,m,p.range?p.range():null):this.call(w,null,p.args,p.keywords,m,p.range?p.range():null)}case"Name":{let w=p.id;if(w==="self")return T;let k=L=>L&&(L.__class__===S.type||L.__class__===C._TupleType||L.__class__===C._SpecialGenericAlias||L.__class__===C._SpecialForm),N=S[w];if(k(N))return N;let h=m.get(w);if(h===void 0){let L=C[w];if(k(L))return L}return h}case"Tuple":return p.elts.map(w=>this.expression(w,m));case"Dict":{let w={};for(let k=0;k<p.keys.length;k++){let N=this.expression(p.keys[k],m),h=this.expression(p.values[k],m);w[N]=h}return w}case"UnaryOp":{if(p.op instanceof b.USub)return-this.expression(p.operand,m);throw new l.Error(`Unsupported unary expression '${p.op}'.`)}case"binary":switch(p.op){case"==":return this.expression(p.left,m)===this.expression(p.right,m);default:throw new l.Error(`Unsupported binary expression '${p.op}'.`)}default:throw new l.Error(`Unsupported expression '${p.type}'.`)}}base(p,m){return this.expression(p,m)}identifier(p){let m=this.ast;return p instanceof m.Name?p.id:p instanceof m.Attribute?`${this.identifier(p.value)}.${p.attr}`:null}target(p,m){let b=this.ast,S=p,C=[];for(;;)if(S instanceof b.Attribute)C.push(S.attr),S=S.value;else if(S instanceof b.Name&&S.id!=="self"&&S.id!=="CONSTANTS"){C.push(S.id);break}else{C=null;break}if(C){let T=null;for(let w=C.length-1;w>=0;w--){let k=C[w];if(T?T=T.__getattr__?T.__getattr__(k):T[k]:T=m.get(k),!T)break}if(!T){C.reverse();let w=C.join("."),k=`${C.join("/")}.py`;this._sources.has(k)?T=this.import(w):T=this.resolve(w)}return T}return this.expression(p,m)}add(p,m){this._sources.set(p,m)}on(p,m){let b=this._events.get(p)||[];b.push(m),this._events.set(p,b)}emit(p,...m){if(this._events.has(p))for(let b of this._events.get(p))b(this,...m)}register(p,m){if(!this._registry.has(p)){m=m||new(this._registry.get("builtins")).module(p),this._registry.set(p,m);let b=p;for(;;){let S=b.lastIndexOf(".");if(S===-1)break;let C=b.substring(S+1);b=b.substring(0,S),m.__module__||(m.__module__=b);let T=this.register(b);T[C]=m,m=T}}return this._registry.get(p)}registerFunction(p,m){let b=this.builtins,S=p.lastIndexOf(".");m||(m=()=>{throw new l.Error(`'${p}' is not implemented.`)}),m.__class__=b.function,m.__name__=S===-1?p:p.substring(S+1),m.__module__=S===-1?"":p.substring(0,S);let C=this.register(m.__module__);if(C[p])throw new l.Error(`Function '${p}' is already registered.`);return C[m.__name__]=m,m}_createType(p,m){let b=this.builtins,S=p.lastIndexOf(".");return m.__class__=b.type,m.__name__=S===-1?p:p.substring(S+1),m.__module__=S===-1?"":p.substring(0,S),m.prototype.__class__=m,m}registerType(p,m){m=this._createType(p,m);let b=p.split("."),S=b.pop(),C=b.join("."),T=this.register(C);if(T[S])throw new l.Error(`Class '${S}' is already registered.`);return T[S]=m,m}};l.Execution.Context=class{constructor(p,m){this.globals=p,this.locals=m}set(p,m){this.locals?this.locals[p]=m:this.globals[p]=m}get(p){if(this.locals&&p in this.locals)return this.locals[p];if(p in this.globals)return this.globals[p]}get target(){return this._target=this._target||[],this._target}};l.BinaryReader=class{constructor(p){this._buffer=p,this._length=p.length,this._position=0,this._view=new DataView(p.buffer,p.byteOffset,p.byteLength),this._utf8Decoder=new TextDecoder("utf-8"),this._asciiDecoder=new TextDecoder("ascii")}get position(){return this._position}get length(){return this._length}seek(p){if(this._position=p>=0?p:this._length+p,this._position>this._buffer.length)throw new l.Error(`Expected ${this._position-this._buffer.length} more bytes. The file might be corrupted. Unexpected end of file.`)}skip(p){if(this._position+=p,this._position>this._buffer.length)throw new l.Error(`Expected ${this._position-this._buffer.length} more bytes. The file might be corrupted. Unexpected end of file.`)}stream(p){let m=this.read(p);return new l.BinaryReader(m)}peek(p){let m=this._position;p=p===void 0?this._length-this._position:p,this.skip(p);let b=this._position;return this.skip(-p),m===0&&p===this._length?this._buffer:this._buffer.subarray(m,b)}read(p){let m=this._position;return p=p===void 0?this._length-this._position:p,this.skip(p),m===0&&p===this._length?this._buffer:this._buffer.subarray(m,this._position)}byte(){let p=this._position;return this.skip(1),this._view.getUint8(p)}uint16(){let p=this._position;return this.skip(2),this._view.getUint16(p,!0)}int32(){let p=this._position;return this.skip(4),this._view.getInt32(p,!0)}uint32(){let p=this._position;return this.skip(4),this._view.getUint32(p,!0)}int64(){let p=this._position;return this.skip(8),this._view.getBigInt64(p,!0)}float64(){let p=this._position;return this.skip(8),this._view.getFloat64(p,!1)}string(p,m){let b=this.read(p);return m==="utf-8"?this._utf8Decoder.decode(b):this._asciiDecoder.decode(b)}line(){let p=this._buffer.indexOf(10,this._position);if(p===-1)throw new l.Error("Could not find end of line.");let m=p-this._position,b=this.string(m,"ascii");return this.skip(1),b}};l.StreamReader=class{constructor(p){this._stream=p,this._length=p.length,this._position=0,this._utf8Decoder=new TextDecoder("utf-8"),this._asciiDecoder=new TextDecoder("ascii")}get position(){return this._position}get length(){return this._length}seek(p){this._stream.seek(p),this._position=this._stream.position}skip(p){if(this._position+=p,this._position>this._length)throw new l.Error(`Expected ${this._position-this._length} more bytes. The file might be corrupted. Unexpected end of file.`)}stream(p){return this._stream.seek(this._position),this.skip(p),this._stream.stream(p)}peek(p){return this._stream.seek(this._position),this._stream.peek(p)}read(p){return this._stream.seek(this._position),this.skip(p),this._stream.read(p)}byte(){let p=this._fill(1);return this._view.getUint8(p)}uint16(){let p=this._fill(2);return this._view.getUint16(p,!0)}int32(){let p=this._fill(4);return this._view.getInt32(p,!0)}uint32(){let p=this._fill(4);return this._view.getUint32(p,!0)}int64(){let p=this._fill(8);return this._view.getBigInt64(p,!0)}float64(){let p=this._fill(8);return this._view.getFloat64(p,!1)}string(p,m){let b=this.read(p);return m==="utf-8"?this._utf8Decoder.decode(b):this._asciiDecoder.decode(b)}line(){let p=this._fill(0),m=this._buffer.indexOf(10,p);if(m===-1){let C=Math.min(536870912,this._stream.length-this._position);if(this._fill(C),this.skip(-C),p=this._fill(0),m=this._buffer.indexOf(10,p),m===-1)throw new l.Error("Could not find end of line.")}let b=m-p,S=this.string(b,"ascii");return this.skip(1),S}_fill(p){if(this._position+p>this._length)throw new Error(`Expected ${this._position+p-this._length} more bytes. The file might be corrupted. Unexpected end of file.`);if(!this._buffer||this._position<this._offset||this._position+p>this._offset+this._buffer.length){this._offset=this._position,this._stream.seek(this._offset);let b=Math.max(p,Math.min(268435456,this._length-this._offset));this._buffer=this._stream.read(b),this._view=new DataView(this._buffer.buffer,this._buffer.byteOffset,this._buffer.byteLength)}let m=this._position;return this._position+=p,m-this._offset}};l.Error=class extends Error{constructor(p){super(p),this.name="Python Error"}};var le=l.Execution;export{le as Execution};
|